Trait FoldNode

Source
pub trait FoldNode<'a>: FoldNode<'a> {
    // Provided method
    fn fold<'b, F: Folder<'a>>(
        &'a self,
        ctx: &'a ASTContext,
        folder: &'b mut F,
    ) -> Result<&'a Self> { ... }
}
Expand description

Trait for folding AST Nodes of a GraphQL language document in depth-first order using a custom folder. This transforms the AST while creating a new copy of it.

The folder must implement the Folder trait.

Provided Methods§

Source

fn fold<'b, F: Folder<'a>>( &'a self, ctx: &'a ASTContext, folder: &'b mut F, ) -> Result<&'a Self>

Visit the GraphQL AST node tree recursively in depth-first order and create a transformed copy of it using the given folder. The folder must implement the Folder trait.

This will return a Result containing a reference to the new copied AST Node allocated on the current AST Context’s arena or an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, T: FoldNode<'a>> FoldNode<'a> for T