Enum object_query::Query[][src]

pub enum Query<'a> {
    Index {
        index: usize,
        from_last: bool,
    },
    Key(Cow<'a, str>),
}
Expand description

Either a key or an index query

Variants

Index

The index query. Represents the index (starting at 0) from either the front or the back

Show fields

Fields of Index

index: usizefrom_last: bool
Key(Cow<'a, str>)

The key query. Represents string key to query by

Implementations

impl Query<'static>[src]

pub fn index(index: usize) -> Self[src]

Create an index query from the front

pub fn index_from_last(index: usize) -> Self[src]

Create an index query from the back

pub fn key_owned(key: String) -> Self[src]

Create a owned key query

impl<'a> Query<'a>[src]

pub fn key(key: &'a str) -> Self[src]

Create a borrowed key query

pub fn is_from_last(&self) -> bool[src]

Is an index query from the back

pub fn is_key(&self) -> bool[src]

Is a key query

pub fn is_index(&self) -> bool[src]

Is an index query

pub fn as_key(&self) -> Option<&str>[src]

Return the string reference if it is a key query

pub fn as_index(&self) -> Option<i64>[src]

Returns an i64 representation of the index if it is a index query. This is either the index or 0 - index - 1 for an index from the back

pub fn to_owned(&self) -> Query<'static>[src]

An alternative to the std::borrow::ToOwned method

Trait Implementations

impl<'a> Clone for Query<'a>[src]

fn clone(&self) -> Query<'static>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for Query<'a>[src]

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

Formats the value using the given formatter. Read more

impl<'a> From<&'a str> for Query<'a>[src]

fn from(key: &'a str) -> Self[src]

Performs the conversion.

impl From<String> for Query<'static>[src]

fn from(key: String) -> Self[src]

Performs the conversion.

impl From<i16> for Query<'static>[src]

fn from(index: i16) -> Self[src]

Performs the conversion.

impl From<i32> for Query<'static>[src]

fn from(index: i32) -> Self[src]

Performs the conversion.

impl From<i64> for Query<'static>[src]

fn from(index: i64) -> Self[src]

Performs the conversion.

impl From<i8> for Query<'static>[src]

fn from(index: i8) -> Self[src]

Performs the conversion.

impl From<isize> for Query<'static>[src]

fn from(index: isize) -> Self[src]

Performs the conversion.

impl From<u16> for Query<'static>[src]

fn from(index: u16) -> Self[src]

Performs the conversion.

impl From<u32> for Query<'static>[src]

fn from(index: u32) -> Self[src]

Performs the conversion.

impl From<u64> for Query<'static>[src]

fn from(index: u64) -> Self[src]

Performs the conversion.

impl From<u8> for Query<'static>[src]

fn from(index: u8) -> Self[src]

Performs the conversion.

impl From<usize> for Query<'static>[src]

fn from(index: usize) -> Self[src]

Performs the conversion.

impl<'a> PartialEq<Query<'a>> for Query<'a>[src]

fn eq(&self, other: &Query<'a>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Query<'a>) -> bool[src]

This method tests for !=.

impl<'a> Eq for Query<'a>[src]

impl<'a> StructuralEq for Query<'a>[src]

impl<'a> StructuralPartialEq for Query<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Query<'a>

impl<'a> Send for Query<'a>

impl<'a> Sync for Query<'a>

impl<'a> Unpin for Query<'a>

impl<'a> UnwindSafe for Query<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.