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 VisitorThe input visitor that implements the visitor trait with *_enter and *_exit callbacks
Implementations§
Source§impl<'a> Traversal<'a>
impl<'a> Traversal<'a>
Sourcepub fn handle_document(
&mut self,
document: &Document,
) -> Result<(), GraphQLError>
pub fn handle_document( &mut self, document: &Document, ) -> Result<(), GraphQLError>
Handle GraphQL Document node
Sourcepub fn handle_operation_definition(
&mut self,
operation_definition: &OperationDefinition,
) -> Result<(), GraphQLError>
pub fn handle_operation_definition( &mut self, operation_definition: &OperationDefinition, ) -> Result<(), GraphQLError>
Handle GraphQL OperationDefinition node
Sourcepub fn handle_query(&mut self, query: &Query) -> Result<(), GraphQLError>
pub fn handle_query(&mut self, query: &Query) -> Result<(), GraphQLError>
Handle GraphQL Query node
Sourcepub fn handle_variable_definition(
&mut self,
variable_definition: &VariableDefinition,
) -> Result<(), GraphQLError>
pub fn handle_variable_definition( &mut self, variable_definition: &VariableDefinition, ) -> Result<(), GraphQLError>
Handle GraphQL VariableDefinition node
Sourcepub fn handle_selection_set(
&mut self,
selection_set: &SelectionSet,
) -> Result<(), GraphQLError>
pub fn handle_selection_set( &mut self, selection_set: &SelectionSet, ) -> Result<(), GraphQLError>
Handle GraphQL SelectionSet node
Sourcepub fn handle_selection(
&mut self,
selection: &Selection,
) -> Result<(), GraphQLError>
pub fn handle_selection( &mut self, selection: &Selection, ) -> Result<(), GraphQLError>
Handle GraphQL Selection node
Sourcepub fn handle_field(&mut self, field: &Field) -> Result<(), GraphQLError>
pub fn handle_field(&mut self, field: &Field) -> Result<(), GraphQLError>
Handle GraphQL Field node
Sourcepub fn handle_fragment_definition(
&mut self,
fragment_definition: &FragmentDefinition,
) -> Result<(), GraphQLError>
pub fn handle_fragment_definition( &mut self, fragment_definition: &FragmentDefinition, ) -> Result<(), GraphQLError>
Handle GraphQL FragmentDefinition node
Sourcepub fn handle_inline_fragment(
&mut self,
inline_fragment: &InlineFragment,
) -> Result<(), GraphQLError>
pub fn handle_inline_fragment( &mut self, inline_fragment: &InlineFragment, ) -> Result<(), GraphQLError>
Handle GraphQL InlineFragment node
Sourcepub fn handle_fragment_spread(
&mut self,
fragment_spread: &FragmentSpread,
) -> Result<(), GraphQLError>
pub fn handle_fragment_spread( &mut self, fragment_spread: &FragmentSpread, ) -> Result<(), GraphQLError>
Handle GraphQL FragmentSpread node
Sourcepub fn handle_directive(
&mut self,
directive: &Directive,
) -> Result<(), GraphQLError>
pub fn handle_directive( &mut self, directive: &Directive, ) -> Result<(), GraphQLError>
Handle GraphQL Directive node
Sourcepub fn handle_type_condition(
&mut self,
type_condition: &TypeCondition,
) -> Result<(), GraphQLError>
pub fn handle_type_condition( &mut self, type_condition: &TypeCondition, ) -> Result<(), GraphQLError>
Handle GraphQL TypeCondition node
Sourcepub fn handle_type(&mut self, type1: &Type) -> Result<(), GraphQLError>
pub fn handle_type(&mut self, type1: &Type) -> Result<(), GraphQLError>
Handle GraphQL Type node
Sourcepub fn handle_name(&mut self, name: &Name) -> Result<(), GraphQLError>
pub fn handle_name(&mut self, name: &Name) -> Result<(), GraphQLError>
Handle GraphQL Name node
Sourcepub fn handle_value(&mut self, value: &Value) -> Result<(), GraphQLError>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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