pub struct NodeId(/* private fields */);Expand description
A versioned identifier for a node in a Blitz DOM tree.
A NodeId packs a 32-bit slot index (low bits) and a 32-bit version
(high bits). Node storage bumps a slot’s version when the slot is
reused, so ids referring to a dropped node no longer resolve (lookups
return None rather than aliasing the new node occupying the slot).
The Default value is a null id which never resolves to a node.
Implementations§
Source§impl NodeId
impl NodeId
Sourcepub fn as_u64(self) -> u64
pub fn as_u64(self) -> u64
Convert this id to its raw u64 representation (index + version).
The value round-trips through NodeId::from_u64. This is useful for
interop with APIs which use integer ids (e.g. Taffy or AccessKit).
Sourcepub fn from_u64(raw: u64) -> Self
pub fn from_u64(raw: u64) -> Self
Reconstruct a NodeId from the raw u64 representation produced by
NodeId::as_u64.
Passing a value that did not come from as_u64 will produce an id
which fails to resolve (it will not alias an unrelated live node).
Trait Implementations§
impl Copy for NodeId
impl Eq for NodeId
Source§impl Ord for NodeId
Ordered by slot index first, then by version, so that ordering roughly
matches node creation order (as with the previous Slab-backed storage)
rather than being dominated by the version bits.
impl Ord for NodeId
Ordered by slot index first, then by version, so that ordering roughly
matches node creation order (as with the previous Slab-backed storage)
rather than being dominated by the version bits.