Trait rustc::middle::ty_fold::TypeFolderExperimental [-]  [+] [src]

pub trait TypeFolder<'tcx> {
    fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>;

    fn fold_ty(&mut self, t: t) -> t { ... }
    fn fold_mt(&mut self, t: &mt) -> mt { ... }
    fn fold_trait_ref(&mut self, t: &TraitRef) -> TraitRef { ... }
    fn fold_sty(&mut self, sty: &sty) -> sty { ... }
    fn fold_substs(&mut self, substs: &Substs) -> Substs { ... }
    fn fold_sig(&mut self, sig: &FnSig) -> FnSig { ... }
    fn fold_output(&mut self, output: &FnOutput) -> FnOutput { ... }
    fn fold_bare_fn_ty(&mut self, fty: &BareFnTy) -> BareFnTy { ... }
    fn fold_closure_ty(&mut self, fty: &ClosureTy) -> ClosureTy { ... }
    fn fold_region(&mut self, r: Region) -> Region { ... }
    fn fold_trait_store(&mut self, s: TraitStore) -> TraitStore { ... }
    fn fold_existential_bounds(&mut self, s: ExistentialBounds) -> ExistentialBounds { ... }
    fn fold_autoref(&mut self, ar: &AutoRef) -> AutoRef { ... }
    fn fold_item_substs(&mut self, i: ItemSubsts) -> ItemSubsts { ... }
    fn fold_obligation(&mut self, o: &Obligation) -> Obligation { ... }
}

The TypeFolder trait defines the actual folding. There is a method defined for every foldable type. Each of these has a default implementation that does an "identity" fold. Within each identity fold, it should invoke foo.fold_with(self) to fold each sub-item.

Required Methods

fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>

Provided Methods

fn fold_ty(&mut self, t: t) -> t

fn fold_mt(&mut self, t: &mt) -> mt

fn fold_trait_ref(&mut self, t: &TraitRef) -> TraitRef

fn fold_sty(&mut self, sty: &sty) -> sty

fn fold_substs(&mut self, substs: &Substs) -> Substs

fn fold_sig(&mut self, sig: &FnSig) -> FnSig

fn fold_output(&mut self, output: &FnOutput) -> FnOutput

fn fold_bare_fn_ty(&mut self, fty: &BareFnTy) -> BareFnTy

fn fold_closure_ty(&mut self, fty: &ClosureTy) -> ClosureTy

fn fold_region(&mut self, r: Region) -> Region

fn fold_trait_store(&mut self, s: TraitStore) -> TraitStore

fn fold_existential_bounds(&mut self, s: ExistentialBounds) -> ExistentialBounds

fn fold_autoref(&mut self, ar: &AutoRef) -> AutoRef

fn fold_item_substs(&mut self, i: ItemSubsts) -> ItemSubsts

fn fold_obligation(&mut self, o: &Obligation) -> Obligation

Implementors