pub trait Fold<From: AstTypes, To: AstTypes = From> {
type Error;
Show 15 methods
// Required methods
fn fold_annotation(
&mut self,
anno: From::Annotation,
) -> Result<To::Annotation, Self::Error>;
fn fold_macro_id(
&mut self,
name: From::MacroId,
) -> Result<To::MacroId, Self::Error>;
fn fold_symbol(
&mut self,
name: From::Symbol,
) -> Result<To::Symbol, Self::Error>;
fn fold_path(&mut self, path: From::Path) -> Result<To::Path, Self::Error>;
fn fold_literal(
&mut self,
lit: From::Literal,
) -> Result<To::Literal, Self::Error>;
// Provided methods
fn fold_at_expr(
&mut self,
expr: At<Expr<From>, From>,
) -> Result<At<Expr<To>, To>, Self::Error> { ... }
fn fold_expr(&mut self, expr: Expr<From>) -> Result<Expr<To>, Self::Error> { ... }
fn fold_use(&mut self, item: Use<From>) -> Result<Use<To>, Self::Error> { ... }
fn fold_at_pat(
&mut self,
pat: At<Pat<From>, From>,
) -> Result<At<Pat<To>, To>, Self::Error> { ... }
fn fold_pat(&mut self, pat: Pat<From>) -> Result<Pat<To>, Self::Error> { ... }
fn fold_bind(&mut self, bind: Bind<From>) -> Result<Bind<To>, Self::Error> { ... }
fn fold_make(&mut self, make: Make<From>) -> Result<Make<To>, Self::Error> { ... }
fn fold_makearm(
&mut self,
arm: MakeArm<From>,
) -> Result<MakeArm<To>, Self::Error> { ... }
fn fold_match(
&mut self,
mtch: Match<From>,
) -> Result<Match<To>, Self::Error> { ... }
fn fold_matcharm(
&mut self,
arm: MatchArm<From>,
) -> Result<MatchArm<To>, Self::Error> { ... }
}Expand description
Required Associated Types§
Required Methods§
Sourcefn fold_annotation(
&mut self,
anno: From::Annotation,
) -> Result<To::Annotation, Self::Error>
fn fold_annotation( &mut self, anno: From::Annotation, ) -> Result<To::Annotation, Self::Error>
Consumes an Annotation in A, possibly transforms it, and produces a replacement Annotation in B
Sourcefn fold_macro_id(
&mut self,
name: From::MacroId,
) -> Result<To::MacroId, Self::Error>
fn fold_macro_id( &mut self, name: From::MacroId, ) -> Result<To::MacroId, Self::Error>
Consumes a MacroId in A, possibly transforms it, and produces a replacement MacroId in B
Sourcefn fold_symbol(&mut self, name: From::Symbol) -> Result<To::Symbol, Self::Error>
fn fold_symbol(&mut self, name: From::Symbol) -> Result<To::Symbol, Self::Error>
Consumes a Symbol in A, possibly transforms it, and produces a replacement Symbol in B
Provided Methods§
Sourcefn fold_at_expr(
&mut self,
expr: At<Expr<From>, From>,
) -> Result<At<Expr<To>, To>, Self::Error>
fn fold_at_expr( &mut self, expr: At<Expr<From>, From>, ) -> Result<At<Expr<To>, To>, Self::Error>
Folds an annotated expression, so the expression and annotation can be seen at once.
Sourcefn fold_at_pat(
&mut self,
pat: At<Pat<From>, From>,
) -> Result<At<Pat<To>, To>, Self::Error>
fn fold_at_pat( &mut self, pat: At<Pat<From>, From>, ) -> Result<At<Pat<To>, To>, Self::Error>
Folds an annotated pattern, so the pattern and annotation can be seen at once.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".