Traversal

Struct Traversal 

Source
pub struct Traversal<'a> {
    pub visitor: &'a mut dyn Visitor,
}
Expand description

Traverse a GraphQL AST in a Depth-first fashion

Each handler in the traversal calls a *_enter method and a *_exit method. Use *_enter visitor if you want to traverse the AST in a pre-order fashion, and *_exit visitor if you want to traverse the AST in a post-order fashion.

Fields§

§visitor: &'a mut dyn Visitor

The input visitor that implements the visitor trait with *_enter and *_exit callbacks

Implementations§

Source§

impl<'a> Traversal<'a>

Source

pub fn handle_document( &mut self, document: &Document, ) -> Result<(), GraphQLError>

Handle GraphQL Document node

Source

pub fn handle_operation_definition( &mut self, operation_definition: &OperationDefinition, ) -> Result<(), GraphQLError>

Handle GraphQL OperationDefinition node

Source

pub fn handle_query(&mut self, query: &Query) -> Result<(), GraphQLError>

Handle GraphQL Query node

Source

pub fn handle_variable_definition( &mut self, variable_definition: &VariableDefinition, ) -> Result<(), GraphQLError>

Handle GraphQL VariableDefinition node

Source

pub fn handle_selection_set( &mut self, selection_set: &SelectionSet, ) -> Result<(), GraphQLError>

Handle GraphQL SelectionSet node

Source

pub fn handle_selection( &mut self, selection: &Selection, ) -> Result<(), GraphQLError>

Handle GraphQL Selection node

Source

pub fn handle_field(&mut self, field: &Field) -> Result<(), GraphQLError>

Handle GraphQL Field node

Source

pub fn handle_fragment_definition( &mut self, fragment_definition: &FragmentDefinition, ) -> Result<(), GraphQLError>

Handle GraphQL FragmentDefinition node

Source

pub fn handle_inline_fragment( &mut self, inline_fragment: &InlineFragment, ) -> Result<(), GraphQLError>

Handle GraphQL InlineFragment node

Source

pub fn handle_fragment_spread( &mut self, fragment_spread: &FragmentSpread, ) -> Result<(), GraphQLError>

Handle GraphQL FragmentSpread node

Source

pub fn handle_directive( &mut self, directive: &Directive, ) -> Result<(), GraphQLError>

Handle GraphQL Directive node

Source

pub fn handle_type_condition( &mut self, type_condition: &TypeCondition, ) -> Result<(), GraphQLError>

Handle GraphQL TypeCondition node

Source

pub fn handle_type(&mut self, type1: &Type) -> Result<(), GraphQLError>

Handle GraphQL Type node

Source

pub fn handle_name(&mut self, name: &Name) -> Result<(), GraphQLError>

Handle GraphQL Name node

Source

pub fn handle_value(&mut self, value: &Value) -> Result<(), GraphQLError>

Handle GraphQL Value node

Auto Trait Implementations§

§

impl<'a> Freeze for Traversal<'a>

§

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

§

impl<'a> !Send for Traversal<'a>

§

impl<'a> !Sync for Traversal<'a>

§

impl<'a> Unpin for Traversal<'a>

§

impl<'a> !UnwindSafe for Traversal<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.