Trait ItemId
pub trait ItemId:
Clone
+ Debug
+ Hash
+ PartialEq
+ Eq {
type State<'tcx>: ?Sized;
// Required methods
fn from_rust_def_id<'tcx>(state: &Self::State<'tcx>, def_id: DefId) -> Self;
fn generics_of<'tcx>(&self, state: &Self::State<'tcx>) -> &'tcx Generics;
fn param_env<'tcx>(&self, state: &Self::State<'tcx>) -> ParamEnv<'tcx>;
fn predicates_defined_on<'tcx>(
&self,
state: &Self::State<'tcx>,
direction: PredicateDirection,
) -> ItemPredicates<'tcx, Self>;
fn self_pred<'tcx>(
&self,
state: &Self::State<'tcx>,
) -> Option<Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>>;
fn as_identity_assoc_ty<'tcx>(
&self,
state: &Self::State<'tcx>,
) -> Option<Ty<'tcx>>;
fn typeck_parent<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>;
fn parent_for_clauses<'tcx>(
&self,
state: &Self::State<'tcx>,
) -> Option<Self>;
fn parent_of_assoc<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>;
fn takes_explicit_self_clause<'tcx>(
&self,
state: &Self::State<'tcx>,
) -> bool;
fn find_in_impl<'tcx>(
&self,
state: &Self::State<'tcx>,
trait_impl: &Self,
) -> Option<Self>;
}Expand description
The identifier of an item; generalizes over rustc’s DefId to allow for virtual items.
Required Associated Types§
Required Methods§
fn from_rust_def_id<'tcx>(state: &Self::State<'tcx>, def_id: DefId) -> Self
fn from_rust_def_id<'tcx>(state: &Self::State<'tcx>, def_id: DefId) -> Self
An identifier that refers to a real Rust item.
fn generics_of<'tcx>(&self, state: &Self::State<'tcx>) -> &'tcx Generics
fn generics_of<'tcx>(&self, state: &Self::State<'tcx>) -> &'tcx Generics
The generics of this item.
fn param_env<'tcx>(&self, state: &Self::State<'tcx>) -> ParamEnv<'tcx>
fn param_env<'tcx>(&self, state: &Self::State<'tcx>) -> ParamEnv<'tcx>
The clauses that can be assumed when inside this item.
fn predicates_defined_on<'tcx>(
&self,
state: &Self::State<'tcx>,
direction: PredicateDirection,
) -> ItemPredicates<'tcx, Self>
fn predicates_defined_on<'tcx>( &self, state: &Self::State<'tcx>, direction: PredicateDirection, ) -> ItemPredicates<'tcx, Self>
The predicates defined directly on this item.
fn self_pred<'tcx>(
&self,
state: &Self::State<'tcx>,
) -> Option<Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>>
fn self_pred<'tcx>( &self, state: &Self::State<'tcx>, ) -> Option<Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>>
If this item is a trait, return its Self predicate.
fn as_identity_assoc_ty<'tcx>(
&self,
state: &Self::State<'tcx>,
) -> Option<Ty<'tcx>>
fn as_identity_assoc_ty<'tcx>( &self, state: &Self::State<'tcx>, ) -> Option<Ty<'tcx>>
The type of this item as an associated type projection, if it is a trait associated type.
fn typeck_parent<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>
fn typeck_parent<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>
If this item is typechecked together with its parent (e.g. inline consts and closures), return that parent.
fn parent_for_clauses<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>
fn parent_for_clauses<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>
If this item inherits the clauses of its parent, return the parent.
fn parent_of_assoc<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>
fn parent_of_assoc<'tcx>(&self, state: &Self::State<'tcx>) -> Option<Self>
If this item is an associated item, return its parent.
fn takes_explicit_self_clause<'tcx>(&self, state: &Self::State<'tcx>) -> bool
fn takes_explicit_self_clause<'tcx>(&self, state: &Self::State<'tcx>) -> bool
Whether this item takes an explicit Self: Trait clause or whether it is allowed to refer
to the ambiant one. Only relevant for associated items.
fn find_in_impl<'tcx>(
&self,
state: &Self::State<'tcx>,
trait_impl: &Self,
) -> Option<Self>
fn find_in_impl<'tcx>( &self, state: &Self::State<'tcx>, trait_impl: &Self, ) -> Option<Self>
If this item is an associated item definition, and the given impl implements it, returns the implemented associated item.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".