pub struct NodeHandle {
pub entity: Entity,
pub generation: u32,
}Expand description
Opaque handle to a live element: an Entity plus the generation it
carried when the handle was minted. Resolving a handle validates the
generation, so a handle to a despawned entity returns None rather
than addressing whatever entity later reused that index.
Fields§
§entity: EntityThe referenced entity (index + generation).
generation: u32The entity’s generation bits at mint time, kept for the packed wire form and for cross-checking after an unpack.
Implementations§
Source§impl NodeHandle
impl NodeHandle
Sourcepub fn pack(self) -> u64
pub fn pack(self) -> u64
Pack into the u64 wire form used by the C-ABI LumenNode and by
hosts whose value type can hold 64 bits. The layout is
Entity::to_bits (index in the low half, generation in the high
half); treat it as opaque and round-trip only through Self::unpack.
Sourcepub fn unpack(bits: u64) -> Option<Self>
pub fn unpack(bits: u64) -> Option<Self>
Reconstruct from the packed wire form. Returns None for bits that
never came from Self::pack (invalid index), never panicking.
Trait Implementations§
Source§impl Clone for NodeHandle
impl Clone for NodeHandle
Source§fn clone(&self) -> NodeHandle
fn clone(&self) -> NodeHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeHandle
impl Debug for NodeHandle
Source§impl PartialEq for NodeHandle
impl PartialEq for NodeHandle
Source§fn eq(&self, other: &NodeHandle) -> bool
fn eq(&self, other: &NodeHandle) -> bool
self and other values to be equal, and is used by ==.impl Copy for NodeHandle
impl Eq for NodeHandle
impl StructuralPartialEq for NodeHandle
Auto Trait Implementations§
impl Freeze for NodeHandle
impl RefUnwindSafe for NodeHandle
impl Send for NodeHandle
impl Sync for NodeHandle
impl Unpin for NodeHandle
impl UnsafeUnpin for NodeHandle
impl UnwindSafe for NodeHandle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DynEq for T
impl<T> DynEq for T
§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
key and return true if they are equal.