pub enum ItemSource {
TopLevel,
Closure {
info: ClosureInfo,
},
TraitDecl {
trait_ref: TraitDeclRef,
item_name: TraitItemName,
has_default: bool,
},
TraitImpl {
impl_ref: TraitImplRef,
trait_ref: TraitDeclRef,
item_name: TraitItemName,
reuses_default: bool,
},
VTableTy {
dyn_predicate: DynPredicate,
},
VTableInstance {
impl_ref: TraitImplRef,
},
VTableMethodShim,
}
Expand description
Item kind: whether this function/const is part of a trait declaration, trait implementation, or neither.
Example:
trait Foo {
fn bar(x : u32) -> u32; // trait item decl without default
fn baz(x : bool) -> bool { x } // trait item decl with default
}
impl Foo for ... {
fn bar(x : u32) -> u32 { x } // trait item implementation
}
fn test(...) { ... } // regular
impl Type {
fn test(...) { ... } // regular
}
Variants§
TopLevel
This item stands on its own.
Closure
This is a closure in a function body.
Fields
info: ClosureInfo
TraitDecl
This is an associated item in a trait declaration. It has a body if and only if the trait provided a default implementation.
Fields
trait_ref: TraitDeclRef
The trait declaration this item belongs to.
item_name: TraitItemName
The name of the item.
TraitImpl
This is an associated item in a trait implementation.
Fields
impl_ref: TraitImplRef
The trait implementation the method belongs to.
trait_ref: TraitDeclRef
The trait declaration that the impl block implements.
item_name: TraitItemName
The name of the item
VTableTy
This is a vtable struct for a trait.
Fields
dyn_predicate: DynPredicate
The dyn Trait
predicate implemented by this vtable.
VTableInstance
This is a vtable value for an impl.
Fields
impl_ref: TraitImplRef
VTableMethodShim
The method shim wraps a concrete implementation of a method into a function that takes dyn Trait
as its Self
type. This shim casts the receiver to the known concrete type and
calls the real method.
Trait Implementations§
Source§impl AstVisitable for ItemSource
impl AstVisitable for ItemSource
Source§fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.Source§fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.Source§fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))
fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))
self
, in pre-order traversal.Source§fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
self
, in pre-order traversal.Source§impl Clone for ItemSource
impl Clone for ItemSource
Source§fn clone(&self) -> ItemSource
fn clone(&self) -> ItemSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ItemSource
impl Debug for ItemSource
Source§impl<'de> Deserialize<'de> for ItemSource
impl<'de> Deserialize<'de> for ItemSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'s, V> Drive<'s, V> for ItemSourcewhere
V: Visitor + Visit<'s, ClosureInfo> + Visit<'s, TraitDeclRef> + Visit<'s, TraitImplRef> + Visit<'s, DynPredicate>,
impl<'s, V> Drive<'s, V> for ItemSourcewhere
V: Visitor + Visit<'s, ClosureInfo> + Visit<'s, TraitDeclRef> + Visit<'s, TraitImplRef> + Visit<'s, DynPredicate>,
Source§fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit()
on the immediate contents of self
.Source§impl<'s, V> DriveMut<'s, V> for ItemSourcewhere
V: Visitor + VisitMut<'s, ClosureInfo> + VisitMut<'s, TraitDeclRef> + VisitMut<'s, TraitImplRef> + VisitMut<'s, DynPredicate>,
impl<'s, V> DriveMut<'s, V> for ItemSourcewhere
V: Visitor + VisitMut<'s, ClosureInfo> + VisitMut<'s, TraitDeclRef> + VisitMut<'s, TraitImplRef> + VisitMut<'s, DynPredicate>,
Source§fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit()
on the immediate contents of self
.Source§impl PartialEq for ItemSource
impl PartialEq for ItemSource
Source§impl Serialize for ItemSource
impl Serialize for ItemSource
impl Eq for ItemSource
impl StructuralPartialEq for ItemSource
Auto Trait Implementations§
impl Freeze for ItemSource
impl RefUnwindSafe for ItemSource
impl Send for ItemSource
impl Sync for ItemSource
impl Unpin for ItemSource
impl UnwindSafe for ItemSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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)
§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>
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>
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
Source§impl<T> TyVisitable for Twhere
T: AstVisitable,
impl<T> TyVisitable for Twhere
T: AstVisitable,
Source§fn visit_vars(&mut self, v: &mut impl VarsVisitor)
fn visit_vars(&mut self, v: &mut impl VarsVisitor)
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
.Source§fn substitute(self, generics: &GenericArgs) -> Self
fn substitute(self, generics: &GenericArgs) -> Self
self
by replacing them with the provided values.
Note: if self
is an item that comes from a TraitDecl
, you most likely want to use
substitute_with_self
.Source§fn substitute_explicits(self, generics: &GenericArgs) -> Self
fn substitute_explicits(self, generics: &GenericArgs) -> Self
Source§fn substitute_with_self(
self,
generics: &GenericArgs,
self_ref: &TraitRefKind,
) -> Self
fn substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Self
TraitRefKind::Self
trait ref.Source§fn move_under_binder(self) -> Self
fn move_under_binder(self) -> Self
Source§fn move_under_binders(self, depth: DeBruijnId) -> Self
fn move_under_binders(self, depth: DeBruijnId) -> Self
depth
binders.Source§fn move_from_under_binder(self) -> Option<Self>
fn move_from_under_binder(self) -> Option<Self>
Source§fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
depth
binders. Returns None
if it contains a variable bound in
one of these depth
binders.Source§fn 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>
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.