pub struct ModuleId(/* private fields */);Expand description
Stable-within-a-run identifier for a referenced Module.
Implementations§
Source§impl ModuleId
impl ModuleId
Sourcepub const fn new(raw: u32) -> Option<Self>
pub const fn new(raw: u32) -> Option<Self>
Construct from a raw 1-based index. Returns None for zero.
Sourcepub fn from_index(raw: usize) -> Self
pub fn from_index(raw: usize) -> Self
Construct from a 0-based index (typical interner output).
Saturates at u32::MAX if raw would not fit in a u32
(i.e. on 64-bit targets at raw >= u32::MAX as usize). One
slot of capacity is sacrificed at the very top; cheap.
Phase 5 module expansion may push id space toward this
limit. If that becomes likely, replace this constructor
with a fallible one that surfaces IdSpaceExhausted.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModuleId
impl<'de> Deserialize<'de> for ModuleId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for ModuleId
impl Ord for ModuleId
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 ModuleId
impl PartialOrd for ModuleId
impl Copy for ModuleId
impl Eq for ModuleId
impl StructuralPartialEq for ModuleId
Auto Trait Implementations§
impl Freeze for ModuleId
impl RefUnwindSafe for ModuleId
impl Send for ModuleId
impl Sync for ModuleId
impl Unpin for ModuleId
impl UnsafeUnpin for ModuleId
impl UnwindSafe for ModuleId
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.