pub enum SearchFilter {
Show 16 variants
    Eq(String, SearchFilterValue),
    Ne(String, SearchFilterValue),
    Gt(String, SearchFilterValue),
    Lt(String, SearchFilterValue),
    Ge(String, SearchFilterValue),
    Le(String, SearchFilterValue),
    In(String, Vec<String>),
    InWithDelimiter(String, Vec<String>, String),
    And(Box<SearchFilter>, Box<SearchFilter>),
    Or(Box<SearchFilter>, Box<SearchFilter>),
    Not(Box<SearchFilter>),
    Parentheses(Box<SearchFilter>),
    Raw(String),
    Field(String),
    Any(String, Option<Box<SearchFilter>>),
    All(String, Box<SearchFilter>),
}Expand description
A composable OData boolean expression.
Supports comparison operators, logical combinators, search.in, and raw sub-expressions.
Variants§
Eq(String, SearchFilterValue)
Ne(String, SearchFilterValue)
Gt(String, SearchFilterValue)
Lt(String, SearchFilterValue)
Ge(String, SearchFilterValue)
Le(String, SearchFilterValue)
In(String, Vec<String>)
InWithDelimiter(String, Vec<String>, String)
search.in(field, 'v1|v2|...', '|') with custom delimiter
And(Box<SearchFilter>, Box<SearchFilter>)
Or(Box<SearchFilter>, Box<SearchFilter>)
Not(Box<SearchFilter>)
Parentheses(Box<SearchFilter>)
Explicit parentheses to override precedence
Raw(String)
Field(String)
Boolean field expression (e.g., IsEnabled)
Any(String, Option<Box<SearchFilter>>)
Collection any() operator (e.g., Rooms/any() or Rooms/any(room: room/BaseRate lt 200))
All(String, Box<SearchFilter>)
Collection all() operator (e.g., Rooms/all(room: not room/SmokingAllowed))
Implementations§
Source§impl SearchFilter
 
impl SearchFilter
Sourcepub fn eq<T: Into<SearchFilterValue>>(
    field: impl Into<String>,
    value: T,
) -> Self
 
pub fn eq<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self
field eq value
Sourcepub fn ne<T: Into<SearchFilterValue>>(
    field: impl Into<String>,
    value: T,
) -> Self
 
pub fn ne<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self
field ne value
Sourcepub fn gt<T: Into<SearchFilterValue>>(
    field: impl Into<String>,
    value: T,
) -> Self
 
pub fn gt<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self
field gt value
Sourcepub fn lt<T: Into<SearchFilterValue>>(
    field: impl Into<String>,
    value: T,
) -> Self
 
pub fn lt<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self
field lt value
Sourcepub fn ge<T: Into<SearchFilterValue>>(
    field: impl Into<String>,
    value: T,
) -> Self
 
pub fn ge<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self
field ge value
Sourcepub fn le<T: Into<SearchFilterValue>>(
    field: impl Into<String>,
    value: T,
) -> Self
 
pub fn le<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self
field le value
Sourcepub fn search_in(field: impl Into<String>, values: Vec<String>) -> Self
 
pub fn search_in(field: impl Into<String>, values: Vec<String>) -> Self
search.in(field, 'v1,v2,...', ',')
Sourcepub fn search_in_with_delimiter(
    field: impl Into<String>,
    values: Vec<String>,
    delimiter: &str,
) -> Self
 
pub fn search_in_with_delimiter( field: impl Into<String>, values: Vec<String>, delimiter: &str, ) -> Self
search.in(field, 'v1|v2|...', '|') with custom delimiter
Sourcepub fn and(self, other: SearchFilter) -> Self
 
pub fn and(self, other: SearchFilter) -> Self
expr1 and expr2
Sourcepub fn or(self, other: SearchFilter) -> Self
 
pub fn or(self, other: SearchFilter) -> Self
expr1 or expr2
Sourcepub fn parentheses(self) -> Self
 
pub fn parentheses(self) -> Self
Wrap expression in explicit parentheses to override precedence
Sourcepub fn raw(expr: impl Into<String>) -> Self
 
pub fn raw(expr: impl Into<String>) -> Self
Insert an arbitrary OData sub-expression (e.g. geo.distance(...) or search.ismatchscoring(...))
Sourcepub fn any(collection_path: impl Into<String>) -> Self
 
pub fn any(collection_path: impl Into<String>) -> Self
Collection any() operator without filter (e.g., Rooms/any())
Sourcepub fn any_with_filter(
    collection_path: impl Into<String>,
    filter: SearchFilter,
) -> Self
 
pub fn any_with_filter( collection_path: impl Into<String>, filter: SearchFilter, ) -> Self
Collection any() operator with filter (e.g., Rooms/any(room: room/BaseRate lt 200))
Sourcepub fn all(collection_path: impl Into<String>, filter: SearchFilter) -> Self
 
pub fn all(collection_path: impl Into<String>, filter: SearchFilter) -> Self
Collection all() operator (e.g., Rooms/all(room: not room/SmokingAllowed))
Sourcepub fn to_odata(&self) -> Result<String, SearchFilterError>
 
pub fn to_odata(&self) -> Result<String, SearchFilterError>
Serialize this filter into a complete OData $filter string.
§Errors
Returns SearchFilterError::ListNotSupportedInOData if any filter value
contains a List variant that cannot be serialized to OData.
Sourcefn format_operand(filter: &SearchFilter) -> Result<String, SearchFilterError>
 
fn format_operand(filter: &SearchFilter) -> Result<String, SearchFilterError>
Helper function to format a filter operand, adding parentheses only when necessary. Simple expressions (comparisons, raw, field, etc.) don’t need parentheses, but complex logical expressions do.
fn to_odata_internal(&self) -> Result<String, SearchFilterError>
Trait Implementations§
Source§impl BitAnd for SearchFilter
 
impl BitAnd for SearchFilter
Source§impl BitOr for SearchFilter
 
impl BitOr for SearchFilter
Source§impl Clone for SearchFilter
 
impl Clone for SearchFilter
Source§fn clone(&self) -> SearchFilter
 
fn clone(&self) -> SearchFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SearchFilter
 
impl Debug for SearchFilter
Source§impl Display for SearchFilter
 
impl Display for SearchFilter
Source§impl Not for SearchFilter
 
impl Not for SearchFilter
Source§impl PartialEq for SearchFilter
 
impl PartialEq for SearchFilter
impl StructuralPartialEq for SearchFilter
Auto Trait Implementations§
impl Freeze for SearchFilter
impl RefUnwindSafe for SearchFilter
impl Send for SearchFilter
impl Sync for SearchFilter
impl Unpin for SearchFilter
impl UnwindSafe for SearchFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
    T: Display,
 
impl<T> ToStringFallible for Twhere
    T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
 
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.