pub struct InternedType(/* private fields */);Expand description
Interned type index - 32 bits, Copy, cheap comparison.
Reserved indices 0-15 are primitives (no lookup needed). Index 16+ are composite types stored in the pool.
§Primitive Encoding
The following indices are reserved for primitive types:
- 0: i8
- 1: i16
- 2: i32
- 3: i64
- 4: u8
- 5: u16
- 6: u32
- 7: u64
- 8: isize
- 9: usize
- 10: f16
- 11: f32
- 12: f64
- 13: bool
- 14: unit
- 15: never
- 16: error
- 17-18: reserved for future primitives
Implementations§
Source§impl InternedType
impl InternedType
pub const I8: InternedType
pub const I16: InternedType
pub const I32: InternedType
pub const I64: InternedType
pub const U8: InternedType
pub const U16: InternedType
pub const U32: InternedType
pub const U64: InternedType
pub const ISIZE: InternedType
pub const USIZE: InternedType
pub const F16: InternedType
pub const F32: InternedType
pub const F64: InternedType
pub const BOOL: InternedType
pub const UNIT: InternedType
pub const NEVER: InternedType
pub const ERROR: InternedType
Sourcepub fn is_primitive(self) -> bool
pub fn is_primitive(self) -> bool
Check if this is a primitive type (no pool lookup needed).
Sourcepub fn from_raw(index: u32) -> Self
pub fn from_raw(index: u32) -> Self
Create an InternedType from a raw index.
§Safety
The caller must ensure the index is valid (either a primitive index 0-15, or a composite index that exists in the pool).
Sourcepub fn pool_index(self) -> Option<u32>
pub fn pool_index(self) -> Option<u32>
Get the pool index for a composite type.
Returns None for primitive types.
Trait Implementations§
Source§impl Clone for InternedType
impl Clone for InternedType
Source§fn clone(&self) -> InternedType
fn clone(&self) -> InternedType
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 moreSource§impl Debug for InternedType
impl Debug for InternedType
Source§impl Default for InternedType
impl Default for InternedType
Source§fn default() -> InternedType
fn default() -> InternedType
Returns the “default value” for a type. Read more
Source§impl Hash for InternedType
impl Hash for InternedType
Source§impl PartialEq for InternedType
impl PartialEq for InternedType
impl Copy for InternedType
impl Eq for InternedType
impl StructuralPartialEq for InternedType
Auto Trait Implementations§
impl Freeze for InternedType
impl RefUnwindSafe for InternedType
impl Send for InternedType
impl Sync for InternedType
impl Unpin for InternedType
impl UnwindSafe for InternedType
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<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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key and return true if they are equal.§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>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef].