#[repr(transparent)]pub struct ResourceId(pub u32);Expand description
Generational handle of a variable-length flat blob in crate::ResourceStore.
Layout matches NodeId: low 24 bits hold the dense slot index (1..=MAX_INDEX; slot 0 is
reserved) and high 8 bits hold the wrap-around generation counter so recycled slots never alias
stale handles (ABA protection). Raw 0 means “none”.
Tuple Fields§
§0: u32Implementations§
Source§impl ResourceId
impl ResourceId
pub const NONE: Self
Sourcepub const INDEX_MASK: u32 = 0x00FF_FFFF
pub const INDEX_MASK: u32 = 0x00FF_FFFF
Bitmask selecting the 24-bit dense slot index.
Sourcepub const MAX_INDEX: u32 = Self::INDEX_MASK
pub const MAX_INDEX: u32 = Self::INDEX_MASK
Maximum valid slot index (16,777,215 concurrent live resources per surface).
pub const fn new(index: u32, generation: u8) -> Self
pub const fn raw(self) -> u32
pub const fn index(self) -> usize
pub const fn generation(self) -> u8
pub const fn is_none(self) -> bool
Trait Implementations§
Source§impl Clone for ResourceId
impl Clone for ResourceId
impl Copy for ResourceId
Source§impl Debug for ResourceId
impl Debug for ResourceId
Source§impl Default for ResourceId
impl Default for ResourceId
impl Eq for ResourceId
Source§impl Hash for ResourceId
impl Hash for ResourceId
Source§impl Ord for ResourceId
impl Ord for ResourceId
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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ResourceId
impl PartialEq for ResourceId
Source§impl PartialOrd for ResourceId
impl PartialOrd for ResourceId
impl StructuralPartialEq for ResourceId
Auto Trait Implementations§
impl Forget for ResourceId
impl Freeze for ResourceId
impl Move for ResourceId
impl RefUnwindSafe for ResourceId
impl Send for ResourceId
impl Sync for ResourceId
impl Unpin for ResourceId
impl UnsafeUnpin for ResourceId
impl UnwindSafe for ResourceId
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