pub struct PoolHandle { /* private fields */ }Expand description
A reference to one object in a pool. Copyable and small: pass it around instead of the object.
The generation is what makes a handle to a removed object read as absent rather than silently addressing whatever took its slot.
Implementations§
Source§impl PoolHandle
impl PoolHandle
Sourcepub const fn from_parts(index: u32, generation: u32) -> Self
pub const fn from_parts(index: u32, generation: u32) -> Self
Rebuild a handle from parts a caller stored elsewhere.
Parts that never named a live object read as absent, exactly as a stale handle does, so this widens no access the pool did not grant.
Sourcepub const fn index(self) -> usize
pub const fn index(self) -> usize
Position in the pool, for a caller keeping a table alongside it.
Sourcepub const fn generation(self) -> u32
pub const fn generation(self) -> u32
The generation this handle was minted at.
Trait Implementations§
Source§impl Clone for PoolHandle
impl Clone for PoolHandle
Source§fn clone(&self) -> PoolHandle
fn clone(&self) -> PoolHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PoolHandle
Source§impl Debug for PoolHandle
impl Debug for PoolHandle
impl Eq for PoolHandle
Source§impl Hash for PoolHandle
impl Hash for PoolHandle
Source§impl PartialEq for PoolHandle
impl PartialEq for PoolHandle
impl StructuralPartialEq for PoolHandle
Auto Trait Implementations§
impl Freeze for PoolHandle
impl RefUnwindSafe for PoolHandle
impl Send for PoolHandle
impl Sync for PoolHandle
impl Unpin for PoolHandle
impl UnsafeUnpin for PoolHandle
impl UnwindSafe for PoolHandle
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> 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.