pub struct NodeMap<T> { /* private fields */ }Expand description
A single-runtime index with at most one live identity per numeric slot. Callers validate creation/generation watermarks before insertion. Every read and removal compares the complete identity, including runtime/generation.
Implementations§
Source§impl<T> NodeMap<T>
impl<T> NodeMap<T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Allocated payload slots, not bytes or business-data cache entries.
pub fn get(&self, id: &NodeId) -> Option<&T>
pub fn get_mut(&mut self, id: &NodeId) -> Option<&mut T>
pub fn contains_key(&self, id: &NodeId) -> bool
Sourcepub fn insert(&mut self, id: NodeId, value: T) -> Option<T>
pub fn insert(&mut self, id: NodeId, value: T) -> Option<T>
Inserting a different live identity in an occupied slot is an internal caller error, not a way to replace a retired generation or foreign node.
pub fn remove(&mut self, id: &NodeId) -> Option<T>
pub fn iter(&self) -> impl Iterator<Item = (&NodeId, &T)>
pub fn values(&self) -> impl Iterator<Item = &T>
Sourcepub fn id_for_token(&self, token: &str) -> Option<NodeId>
pub fn id_for_token(&self, token: &str) -> Option<NodeId>
Resolve only canonical decimal wire identities against a live slot. No NodeId is manufactured from untrusted DOM text.
Trait Implementations§
Auto Trait Implementations§
impl<T> Forget for NodeMap<T>
impl<T> Freeze for NodeMap<T>
impl<T> Move for NodeMap<T>
impl<T> RefUnwindSafe for NodeMap<T>
impl<T> Send for NodeMap<T>
impl<T> Sync for NodeMap<T>
impl<T> Unpin for NodeMap<T>
impl<T> UnsafeUnpin for NodeMap<T>
impl<T> UnwindSafe for NodeMap<T>
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