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>
impl<'a> Lookahead<'a>
sourcepub fn field(&self, name: &str) -> Self
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 }
.
sourcepub fn selection_fields(&self) -> Vec<SelectionField<'a>> ⓘ
pub fn selection_fields(&self) -> Vec<SelectionField<'a>> ⓘ
Get the SelectionField
s 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>
impl<'a> From<SelectionField<'a>> for Lookahead<'a>
source§fn from(selection_field: SelectionField<'a>) -> Self
fn from(selection_field: SelectionField<'a>) -> Self
Converts to this type from the input type.
source§impl<'a> TryFrom<&[SelectionField<'a>]> for Lookahead<'a>
impl<'a> TryFrom<&[SelectionField<'a>]> for Lookahead<'a>
Convert a slice of SelectionField
s to a Lookahead
.
Assumes all SelectionField
s are from the same query and thus have the same
fragments.
Fails if either no SelectionField
s were provided.