Query

Struct Query 

Source
pub struct Query<E: Queryable> { /* private fields */ }
Expand description

The container and root for queries.

See the module documentation for a explanation.

Implementations§

Source§

impl<E: Queryable> Query<E>

Source

pub fn into_normal_representation(self) -> String

Turn this Query into it’s normal representations, that actually conforms to the EBNF given in the module documentation.

§Note

This is just calling the Display implementation.

Source§

impl<E: Queryable> Query<E>

Source

pub fn from_continuous_str( user_state: &<E::KeyValue as QueryKeyValue>::UserState, s: &str, parse_mode: ParseMode, ) -> Result<Query<E>, Error<E>>

Construct this Query from a continuous string. This will correctly split the string according to shell splitting rules (i.e., it takes double and single quotes into account). This is useful, if you only don’t have a shell in between taking this string from your user. If your already have a split string, use Query::from_slice.

§Errors

If the input does not parse as a Query.

Source

pub fn from_slice<'a, T>( user_state: &<E::KeyValue as QueryKeyValue>::UserState, s: T, parse_mode: ParseMode, ) -> Result<Query<E>, Error<E>>
where T: Iterator<Item = &'a str>, <E::KeyValue as QueryKeyValue>::Err: Debug + Display,

Construct this Query from an already split up string. This will assume that similar parts are in one split (i.e., title:Nice AND status:open, should resolve to three distinct splits). Only use this function if your input is already split up by something like a UNIX shell. Otherwise, you can use Query::from_continuous_str to supply a (correctly quoted) string.

§Errors

If the input does not parse as a Query.

Source

pub fn matches(&self, object: &E) -> bool

Check whether this Query matches the Queryable object.

Source

pub fn from_matcher(matcher: Matcher<E>) -> Self

Construct this Query from a Matcher.

This is useful, if you need to construct a query or want to compose multiple queries together (for example, after accessing matchers via Query::as_matcher).

Source

pub fn as_matcher(&self) -> Option<&Matcher<E>>

Get access to the underlying Matcher of this Query.

Source

pub fn into_matcher(self) -> Option<Matcher<E>>

Turn this Query into its underlying Matcher.

Source

pub fn as_mut_matcher(&mut self) -> Option<&mut Matcher<E>>

Get access to the underlying mutable Matcher of this Query.

Trait Implementations§

Source§

impl<E: Clone + Queryable> Clone for Query<E>

Source§

fn clone(&self) -> Query<E>

Returns a duplicate 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<E: Debug + Queryable> Debug for Query<E>

Source§

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

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

impl<E: Queryable> Display for Query<E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E> Freeze for Query<E>
where <E as Queryable>::KeyValue: Freeze,

§

impl<E> RefUnwindSafe for Query<E>

§

impl<E> Send for Query<E>
where <E as Queryable>::KeyValue: Send,

§

impl<E> Sync for Query<E>
where <E as Queryable>::KeyValue: Sync,

§

impl<E> Unpin for Query<E>
where <E as Queryable>::KeyValue: Unpin,

§

impl<E> UnwindSafe for Query<E>
where <E as Queryable>::KeyValue: UnwindSafe,

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, 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<T> ErasedDestructor for T
where T: 'static,