Enum SearchFilter

Source
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

Source

pub fn eq<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self

field eq value

Source

pub fn ne<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self

field ne value

Source

pub fn gt<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self

field gt value

Source

pub fn lt<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self

field lt value

Source

pub fn ge<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self

field ge value

Source

pub fn le<T: Into<SearchFilterValue>>( field: impl Into<String>, value: T, ) -> Self

field le value

Source

pub fn search_in(field: impl Into<String>, values: Vec<String>) -> Self

search.in(field, 'v1,v2,...', ',')

Source

pub fn search_in_with_delimiter( field: impl Into<String>, values: Vec<String>, delimiter: &str, ) -> Self

search.in(field, 'v1|v2|...', '|') with custom delimiter

Source

pub fn and(self, other: SearchFilter) -> Self

expr1 and expr2

Source

pub fn or(self, other: SearchFilter) -> Self

expr1 or expr2

Source

pub fn not(self) -> Self

not (expr)

Source

pub fn parentheses(self) -> Self

Wrap expression in explicit parentheses to override precedence

Source

pub fn raw(expr: impl Into<String>) -> Self

Insert an arbitrary OData sub-expression (e.g. geo.distance(...) or search.ismatchscoring(...))

Source

pub fn field(field_name: impl Into<String>) -> Self

Boolean field expression (e.g., IsEnabled)

Source

pub fn any(collection_path: impl Into<String>) -> Self

Collection any() operator without filter (e.g., Rooms/any())

Source

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))

Source

pub fn all(collection_path: impl Into<String>, filter: SearchFilter) -> Self

Collection all() operator (e.g., Rooms/all(room: not room/SmokingAllowed))

Source

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.

Source

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.

Source

fn to_odata_internal(&self) -> Result<String, SearchFilterError>

Trait Implementations§

Source§

impl BitAnd for SearchFilter

Source§

type Output = SearchFilter

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr for SearchFilter

Source§

type Output = SearchFilter

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl Clone for SearchFilter

Source§

fn clone(&self) -> SearchFilter

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SearchFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SearchFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Not for SearchFilter

Source§

type Output = SearchFilter

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for SearchFilter

Source§

fn eq(&self, other: &SearchFilter) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SearchFilter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Chain<T> for T

Source§

fn len(&self) -> usize

The number of items that this chain link consists of.
Source§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Container<T> for T
where T: Clone,

Source§

type Iter = Once<T>

An iterator over the items within this container, by value.
Source§

fn get_iter(&self) -> <T as Container<T>>::Iter

Iterate over the elements of the container (using internal iteration because GATs are unstable).
Source§

impl<T> DynClone for T
where T: Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> OrderedContainer<T> for T
where T: Clone,