pub(crate) struct SubstVisitor<'a> {
generics: &'a GenericArgs,
self_ref: &'a TraitRefKind,
}
Expand description
Visitor for the TyVisitable::substitute function. This substitutes variables bound at the level where we start to substitute (level 0).
Fields§
§generics: &'a GenericArgs
§self_ref: &'a TraitRefKind
Implementations§
Source§impl<'a> SubstVisitor<'a>
impl<'a> SubstVisitor<'a>
pub(crate) fn new(generics: &'a GenericArgs, self_ref: &'a TraitRefKind) -> Self
Sourcefn process_var<Id, T>(
&self,
var: DeBruijnVar<Id>,
get: impl Fn(Id) -> &'a T,
) -> Option<T>
fn process_var<Id, T>( &self, var: DeBruijnVar<Id>, get: impl Fn(Id) -> &'a T, ) -> Option<T>
Returns the value for this variable, if any.
Trait Implementations§
Source§impl VarsVisitor for SubstVisitor<'_>
impl VarsVisitor for SubstVisitor<'_>
fn visit_region_var(&mut self, v: RegionDbVar) -> Option<Region>
fn visit_type_var(&mut self, v: TypeDbVar) -> Option<Ty>
fn visit_const_generic_var( &mut self, v: ConstGenericDbVar, ) -> Option<ConstGeneric>
fn visit_clause_var(&mut self, v: ClauseDbVar) -> Option<TraitRefKind>
fn visit_self_clause(&mut self) -> Option<TraitRefKind>
Source§impl<'a> Visitor for SubstVisitor<'a>
impl<'a> Visitor for SubstVisitor<'a>
Source§type Break = Infallible
type Break = Infallible
The type used for early-return, if the visitor supports it. Use an empty type like
std::convert::Infallible
if the visitor does not short-circuit.Auto Trait Implementations§
impl<'a> Freeze for SubstVisitor<'a>
impl<'a> RefUnwindSafe for SubstVisitor<'a>
impl<'a> Send for SubstVisitor<'a>
impl<'a> Sync for SubstVisitor<'a>
impl<'a> Unpin for SubstVisitor<'a>
impl<'a> UnwindSafe for SubstVisitor<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more