Struct async_graphql::Lookahead

source ·
pub struct Lookahead<'a> { /* private fields */ }
Expand description

A selection performed by a query.

Implementations§

source§

impl<'a> Lookahead<'a>

source

pub fn field(&self, name: &str) -> Self

Get the field of the selection set with the specified name. This will ignore aliases.

For example, calling .field("a") on { a { b } } will return a lookahead that represents { b }.

source

pub fn exists(&self) -> bool

Returns true if field exists otherwise return false.

source

pub fn selection_fields(&self) -> Vec<SelectionField<'a>>

Get the SelectionFields for each of the fields covered by this Lookahead.

There will be multiple fields in situations where the same field is queried twice.

Trait Implementations§

source§

impl<'a> From<SelectionField<'a>> for Lookahead<'a>

source§

fn from(selection_field: SelectionField<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> TryFrom<&[SelectionField<'a>]> for Lookahead<'a>

Convert a slice of SelectionFields to a Lookahead. Assumes all SelectionFields are from the same query and thus have the same fragments.

Fails if either no SelectionFields were provided.

§

type Error = ()

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

fn try_from( selection_fields: &[SelectionField<'a>], ) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for Lookahead<'a>

§

impl<'a> !RefUnwindSafe for Lookahead<'a>

§

impl<'a> Send for Lookahead<'a>

§

impl<'a> Sync for Lookahead<'a>

§

impl<'a> Unpin for Lookahead<'a>

§

impl<'a> !UnwindSafe for Lookahead<'a>

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> 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, U> TryFrom<U> for T
where 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 T
where 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.