pub trait FallibleTypeFolder<I: Interner>: Sized {
type Error;
// Required method
fn cx(&self) -> I;
// Provided methods
fn try_fold_binder<T>(
&mut self,
t: Binder<I, T>,
) -> Result<Binder<I, T>, Self::Error>
where T: TypeFoldable<I> { ... }
fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Self::Error> { ... }
fn try_fold_region(
&mut self,
r: I::Region,
) -> Result<I::Region, Self::Error> { ... }
fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Self::Error> { ... }
fn try_fold_predicate(
&mut self,
p: I::Predicate,
) -> Result<I::Predicate, Self::Error> { ... }
}
Expand description
This trait is implemented for every folding traversal. There is a fold method defined for every type of interest. Each such method has a default that does an “identity” fold.
A blanket implementation of this trait (that defers to the relevant
method of TypeFolder
) is provided for all infallible folders in
order to ensure the two APIs are coherent.
Required Associated Types§
Required Methods§
Provided Methods§
fn try_fold_binder<T>(
&mut self,
t: Binder<I, T>,
) -> Result<Binder<I, T>, Self::Error>where
T: TypeFoldable<I>,
fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Self::Error>
fn try_fold_region(&mut self, r: I::Region) -> Result<I::Region, Self::Error>
fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Self::Error>
fn try_fold_predicate( &mut self, p: I::Predicate, ) -> Result<I::Predicate, Self::Error>
Object Safety§
This trait is not object safe.