pub struct NodeTree(/* private fields */);Expand description
The versioned map in which the nodes of the DOM tree are stored, backed by
a slotmap::SlotMap.
Nodes are addressed by NodeId, which carries the slot’s version in
addition to its index: when a node is dropped and its slot reused, ids
referring to the dropped node no longer resolve (NodeTree::get returns
None, and indexing panics) instead of aliasing the new occupant.
Implementations§
Source§impl NodeTree
impl NodeTree
pub fn is_empty(&self) -> bool
Sourcepub fn contains_key(&self, id: NodeId) -> bool
pub fn contains_key(&self, id: NodeId) -> bool
Whether id resolves to a live node.
Sourcepub fn get(&self, id: NodeId) -> Option<&Node>
pub fn get(&self, id: NodeId) -> Option<&Node>
Get a reference to the node with the given id, if it is still live.
Sourcepub fn get_mut(&mut self, id: NodeId) -> Option<&mut Node>
pub fn get_mut(&mut self, id: NodeId) -> Option<&mut Node>
Get a mutable reference to the node with the given id, if it is still live.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for NodeTree
impl !UnwindSafe for NodeTree
impl Freeze for NodeTree
impl Send for NodeTree
impl Sync for NodeTree
impl Unpin for NodeTree
impl UnsafeUnpin for NodeTree
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert