Skip to main content

NodeMap

Struct NodeMap 

Source
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>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn capacity(&self) -> usize

Allocated payload slots, not bytes or business-data cache entries.

Source

pub fn get(&self, id: &NodeId) -> Option<&T>

Source

pub fn get_mut(&mut self, id: &NodeId) -> Option<&mut T>

Source

pub fn contains_key(&self, id: &NodeId) -> bool

Source

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.

Source

pub fn remove(&mut self, id: &NodeId) -> Option<T>

Source

pub fn iter(&self) -> impl Iterator<Item = (&NodeId, &T)>

Source

pub fn values(&self) -> impl Iterator<Item = &T>

Source

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§

Source§

impl<T: Debug> Debug for NodeMap<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for NodeMap<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Index<&NodeId> for NodeMap<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, id: &NodeId) -> &T

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T> Forget for NodeMap<T>

§

impl<T> Freeze for NodeMap<T>
where Vec<Option<Box<[Option<(NodeId, T)>]>>>: Freeze, HashMap<usize, Box<[Option<(NodeId, T)>]>>: Freeze,

§

impl<T> Move for NodeMap<T>

§

impl<T> RefUnwindSafe for NodeMap<T>

§

impl<T> Send for NodeMap<T>
where Vec<Option<Box<[Option<(NodeId, T)>]>>>: Send, HashMap<usize, Box<[Option<(NodeId, T)>]>>: Send,

§

impl<T> Sync for NodeMap<T>
where Vec<Option<Box<[Option<(NodeId, T)>]>>>: Sync, HashMap<usize, Box<[Option<(NodeId, T)>]>>: Sync,

§

impl<T> Unpin for NodeMap<T>
where Vec<Option<Box<[Option<(NodeId, T)>]>>>: Unpin, HashMap<usize, Box<[Option<(NodeId, T)>]>>: Unpin,

§

impl<T> UnsafeUnpin for NodeMap<T>

§

impl<T> UnwindSafe for NodeMap<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.