pub struct TypeId(/* private fields */);Expand description
An opaque, interned identifier for a type. Equality on TypeId is type
identity for descriptor-table lookups.
The inner word is private: the only producers are
TypeDescriptor::builtin (which derives it from a BuiltinTypeId) and
the test-only escape hatch, so a hand-written integer literal cannot
impersonate a built-in.
Implementations§
Source§impl TypeId
impl TypeId
pub const fn to_u32(self) -> u32
Sourcepub const fn as_builtin(self) -> Option<BuiltinTypeId>
pub const fn as_builtin(self) -> Option<BuiltinTypeId>
The built-in this id names, or None for a non-built-in (today: only
the test descriptors, which live at the top of the u32 range).
Trait Implementations§
impl Copy for TypeId
impl Eq for TypeId
Source§impl Ord for TypeId
impl Ord for TypeId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for TypeId
impl PartialOrd for TypeId
impl StructuralPartialEq for TypeId
Auto Trait Implementations§
impl Freeze for TypeId
impl RefUnwindSafe for TypeId
impl Send for TypeId
impl Sync for TypeId
impl Unpin for TypeId
impl UnsafeUnpin for TypeId
impl UnwindSafe for TypeId
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