pub enum SearchQueryCondition {
    Contains {
        value: String,
    },
    EndsWith {
        value: String,
    },
    Equals {
        value: String,
    },
    Or {
        value: Vec<SearchQueryCondition>,
    },
    Regex {
        value: String,
    },
    StartsWith {
        value: String,
    },
}
Expand description

Condition used to find a match in a search query

Variants§

§

Contains

Fields

§value: String

Text is found anywhere (all regex patterns are escaped)

§

EndsWith

Fields

§value: String

Begins with some text (all regex patterns are escaped)

§

Equals

Fields

§value: String

Matches some text exactly (all regex patterns are escaped)

§

Or

Any of the conditions match

§

Regex

Fields

§value: String

Matches some regex

§

StartsWith

Fields

§value: String

Begins with some text (all regex patterns are escaped)

Implementations§

source§

impl SearchQueryCondition

source

pub fn contains(value: impl Into<String>) -> Self

Creates a new instance with Contains variant

source

pub fn ends_with(value: impl Into<String>) -> Self

Creates a new instance with EndsWith variant

source

pub fn equals(value: impl Into<String>) -> Self

Creates a new instance with Equals variant

source

pub fn or<I, C>(value: I) -> Selfwhere I: IntoIterator<Item = C>, C: Into<SearchQueryCondition>,

Creates a new instance with Or variant

source

pub fn regex(value: impl Into<String>) -> Self

Creates a new instance with Regex variant

source

pub fn starts_with(value: impl Into<String>) -> Self

Creates a new instance with StartsWith variant

source

pub fn to_regex_string(&self) -> String

Converts the condition in a regex string

Trait Implementations§

source§

impl Clone for SearchQueryCondition

source§

fn clone(&self) -> SearchQueryCondition

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 SearchQueryCondition

source§

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

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

impl<'de> Deserialize<'de> for SearchQueryCondition

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl FromStr for SearchQueryCondition

source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses search query from a JSON string

§

type Err = Infallible

The associated error which can be returned from parsing.
source§

impl PartialEq<SearchQueryCondition> for SearchQueryCondition

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for SearchQueryCondition

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for SearchQueryCondition

source§

impl StructuralEq for SearchQueryCondition

source§

impl StructuralPartialEq for SearchQueryCondition

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,