pub struct TraitDatum<I: Interner> {
pub id: TraitId<I>,
pub binders: Binders<TraitDatumBound<I>>,
pub flags: TraitFlags,
pub associated_ty_ids: Vec<AssocTypeId<I>>,
pub well_known: Option<WellKnownTrait>,
}
Expand description
A rust intermediate representation (rust_ir) of a Trait Definition. For example, given the following rust code:
ⓘ
use std::fmt::Debug;
trait Foo<T>
where
T: Debug,
{
type Bar<U>;
}
This would represent the trait Foo
declaration. Note that the details of
the trait members (e.g., the associated type declaration (type Bar<U>
) are
not contained in this type, and are represented separately (e.g., in
AssociatedTyDatum
).
Not to be confused with the rust_ir for a Trait Implementation, which is
represented by ImplDatum
Fields§
§id: TraitId<I>
§binders: Binders<TraitDatumBound<I>>
§flags: TraitFlags
“Flags” indicate special kinds of traits, like auto traits.
In Rust syntax these are represented in different ways, but in
chalk we add annotations like #[auto]
.
associated_ty_ids: Vec<AssocTypeId<I>>
§well_known: Option<WellKnownTrait>
If this is a well-known trait, which one? If None
, this is a regular,
user-defined trait.
Implementations§
Source§impl<I: Interner> TraitDatum<I>
impl<I: Interner> TraitDatum<I>
pub fn is_auto_trait(&self) -> bool
pub fn is_non_enumerable_trait(&self) -> bool
pub fn is_coinductive_trait(&self) -> bool
Trait Implementations§
Source§impl<I: Clone + Interner> Clone for TraitDatum<I>
impl<I: Clone + Interner> Clone for TraitDatum<I>
Source§fn clone(&self) -> TraitDatum<I>
fn clone(&self) -> TraitDatum<I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<I: Eq + Interner> Eq for TraitDatum<I>
impl<I: Interner> StructuralPartialEq for TraitDatum<I>
Auto Trait Implementations§
impl<I> Freeze for TraitDatum<I>
impl<I> RefUnwindSafe for TraitDatum<I>where
<I as Interner>::DefId: RefUnwindSafe,
<I as Interner>::InternedParameterKinds: RefUnwindSafe,
<I as Interner>::InternedSubstitution: RefUnwindSafe,
<I as Interner>::InternedType: RefUnwindSafe,
impl<I> Send for TraitDatum<I>where
<I as Interner>::DefId: Send,
<I as Interner>::InternedParameterKinds: Send,
<I as Interner>::InternedSubstitution: Send,
<I as Interner>::InternedType: Send,
impl<I> Sync for TraitDatum<I>where
<I as Interner>::DefId: Sync,
<I as Interner>::InternedParameterKinds: Sync,
<I as Interner>::InternedSubstitution: Sync,
<I as Interner>::InternedType: Sync,
impl<I> Unpin for TraitDatum<I>where
<I as Interner>::DefId: Unpin,
<I as Interner>::InternedParameterKinds: Unpin,
<I as Interner>::InternedSubstitution: Unpin,
<I as Interner>::InternedType: Unpin,
impl<I> UnwindSafe for TraitDatum<I>where
<I as Interner>::DefId: UnwindSafe,
<I as Interner>::InternedParameterKinds: UnwindSafe,
<I as Interner>::InternedSubstitution: UnwindSafe,
<I as Interner>::InternedType: UnwindSafe,
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