pub trait TyVisitable: Sized + AstVisitable {
Show 14 methods
// Provided methods
fn visit_vars(&mut self, v: &mut impl VarsVisitor) { ... }
fn substitute(self, generics: &GenericArgs) -> Self { ... }
fn substitute_inner_binder(self, generics: &GenericArgs) -> Self { ... }
fn substitute_explicits(self, generics: &GenericArgs) -> Self { ... }
fn substitute_with_self(
self,
generics: &GenericArgs,
self_ref: &TraitRefKind,
) -> Self { ... }
fn substitute_with_tref(self, tref: &TraitRef) -> Self { ... }
fn try_substitute(
self,
generics: &GenericArgs,
) -> Result<Self, GenericsMismatch> { ... }
fn try_substitute_with_self(
self,
generics: &GenericArgs,
self_ref: &TraitRefKind,
) -> Result<Self, GenericsMismatch> { ... }
fn move_under_binder(self) -> Self { ... }
fn move_under_binders(self, depth: DeBruijnId) -> Self { ... }
fn move_from_under_binder(self) -> Option<Self> { ... }
fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self> { ... }
fn visit_db_id<B>(
&mut self,
f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>,
) -> ControlFlow<B> { ... }
fn replace_erased_regions(self, f: impl FnMut() -> Region) -> Self { ... }
}Expand description
Types that are involved at the type-level and may be substituted around.
Provided Methods§
Sourcefn visit_vars(&mut self, v: &mut impl VarsVisitor)
fn visit_vars(&mut self, v: &mut impl VarsVisitor)
Visit the variables contained in self, as seen from the outside of self. This means
that any variable bound inside self will be skipped, and all the seen De Bruijn indices
will count from the outside of self.
Sourcefn substitute(self, generics: &GenericArgs) -> Self
fn substitute(self, generics: &GenericArgs) -> Self
Substitute the generic variables inside self by replacing them with the provided values.
Note: if self is an item that comes from a TraitDecl, you must use
substitute_with_self or substitute_inner_binder, otherwise you’ll get panics.
Sourcefn substitute_inner_binder(self, generics: &GenericArgs) -> Self
fn substitute_inner_binder(self, generics: &GenericArgs) -> Self
Substitute the generic variables inside self by replacing them with the provided values.
This is appropriate when substituting an inner binder.
Sourcefn substitute_explicits(self, generics: &GenericArgs) -> Self
fn substitute_explicits(self, generics: &GenericArgs) -> Self
Substitute only the type, region and const generic args.
Sourcefn substitute_with_self(
self,
generics: &GenericArgs,
self_ref: &TraitRefKind,
) -> Self
fn substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Self
Substitute the generic variables as well as the TraitRefKind::SelfId trait ref.
Sourcefn substitute_with_tref(self, tref: &TraitRef) -> Self
fn substitute_with_tref(self, tref: &TraitRef) -> Self
Substitute the generic variables as well as the TraitRefKind::SelfId trait ref.
fn try_substitute( self, generics: &GenericArgs, ) -> Result<Self, GenericsMismatch>
fn try_substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Result<Self, GenericsMismatch>
Sourcefn move_under_binder(self) -> Self
fn move_under_binder(self) -> Self
Move under one binder.
Sourcefn move_under_binders(self, depth: DeBruijnId) -> Self
fn move_under_binders(self, depth: DeBruijnId) -> Self
Move under depth binders.
Sourcefn move_from_under_binder(self) -> Option<Self>
fn move_from_under_binder(self) -> Option<Self>
Move from under one binder.
Sourcefn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
Move the value out of depth binders. Returns None if it contains a variable bound in
one of these depth binders.
Sourcefn visit_db_id<B>(
&mut self,
f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>,
) -> ControlFlow<B>
fn visit_db_id<B>( &mut self, f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>, ) -> ControlFlow<B>
Visit the de Bruijn ids contained in self, as seen from the outside of self. This means
that any variable bound inside self will be skipped, and all the seen indices will count
from the outside of self.
Sourcefn replace_erased_regions(self, f: impl FnMut() -> Region) -> Self
fn replace_erased_regions(self, f: impl FnMut() -> Region) -> Self
Replace all the erased regions by the output of the provided function. Binders levels are handled automatically.
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.