pub struct Trait<'tcx> {
def_id: DefId,
args: Option<GenericArgs<'tcx>>,
param_env: ParamEnv<'tcx>,
implied_predicates: GenericPredicates<'tcx>,
is_unsafe: bool,
is_auto: bool,
impl_restriction: Option<DefId>,
self_predicate: TraitPredicate<'tcx>,
dyn_self: Option<Ty<'tcx>>,
items: OnceCell<Vec<AssocItem<'tcx>>>,
}Fields§
§def_id: DefId§args: Option<GenericArgs<'tcx>>§param_env: ParamEnv<'tcx>§implied_predicates: GenericPredicates<'tcx>§is_unsafe: bool§is_auto: bool§impl_restriction: Option<DefId>The module to which impls of this trait are restricted, if any (impl(crate) trait).
self_predicate: TraitPredicate<'tcx>The special Self: Trait clause.
dyn_self: Option<Ty<'tcx>>dyn Trait<Args.., Ty = <Self as Trait>::Ty..> for this trait. This is Some iff this
trait is dyn-compatible.
items: OnceCell<Vec<AssocItem<'tcx>>>Computed on demand, see Trait::items.
Implementations§
Source§impl<'tcx> Trait<'tcx>
impl<'tcx> Trait<'tcx>
pub fn param_env(&self) -> &ParamEnv<'tcx>
pub fn implied_predicates(&self) -> &GenericPredicates<'tcx>
Sourcepub fn self_predicate(&self) -> &TraitPredicate<'tcx>
pub fn self_predicate(&self) -> &TraitPredicate<'tcx>
The special Self: Trait clause.
Sourcepub fn items(&self, s: &impl BaseState<'tcx>) -> &[AssocItem<'tcx>]
pub fn items(&self, s: &impl BaseState<'tcx>) -> &[AssocItem<'tcx>]
Associated items, in definition order.
Sourcepub fn dyn_self(&self) -> Option<&Ty<'tcx>>
pub fn dyn_self(&self) -> Option<&Ty<'tcx>>
dyn Trait<Args.., Ty = <Self as Trait>::Ty..> for this trait. This is Some iff this
trait is dyn-compatible.
Sourcepub fn is_unsafe(&self) -> bool
pub fn is_unsafe(&self) -> bool
Whether this is an unsafe trait, i.e. implementing it requires unsafe impl.
Sourcepub fn impl_restriction(&self) -> Option<&DefId>
pub fn impl_restriction(&self) -> Option<&DefId>
The module to which impls of this trait are restricted, if any (impl(crate) trait).
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> !DynSync for Trait<'tcx>
impl<'tcx> !Freeze for Trait<'tcx>
impl<'tcx> !RefUnwindSafe for Trait<'tcx>
impl<'tcx> !Sync for Trait<'tcx>
impl<'tcx> !UnwindSafe for Trait<'tcx>
impl<'tcx> DynSend for Trait<'tcx>
impl<'tcx> Forget for Trait<'tcx>
impl<'tcx> Move for Trait<'tcx>
impl<'tcx> Send for Trait<'tcx>
impl<'tcx> Unpin for Trait<'tcx>
impl<'tcx> UnsafeUnpin for Trait<'tcx>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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