pub struct NodeId { /* private fields */ }
Expand description
A node identifier within a particular Arena
Implementations§
Source§impl NodeId
impl NodeId
Sourcepub fn ancestors<T>(self, arena: &Arena<T>) -> Ancestors<'_, T> ⓘ
pub fn ancestors<T>(self, arena: &Arena<T>) -> Ancestors<'_, T> ⓘ
Return an iterator of references to this node and its ancestors.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub fn preceding_siblings<T>(self, arena: &Arena<T>) -> PrecedingSiblings<'_, T> ⓘ
pub fn preceding_siblings<T>(self, arena: &Arena<T>) -> PrecedingSiblings<'_, T> ⓘ
Return an iterator of references to this node and the siblings before it.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub fn following_siblings<T>(self, arena: &Arena<T>) -> FollowingSiblings<'_, T> ⓘ
pub fn following_siblings<T>(self, arena: &Arena<T>) -> FollowingSiblings<'_, T> ⓘ
Return an iterator of references to this node and the siblings after it.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub fn children<T>(self, arena: &Arena<T>) -> Children<'_, T> ⓘ
pub fn children<T>(self, arena: &Arena<T>) -> Children<'_, T> ⓘ
Return an iterator of references to this node’s children.
Sourcepub fn reverse_children<T>(self, arena: &Arena<T>) -> ReverseChildren<'_, T> ⓘ
pub fn reverse_children<T>(self, arena: &Arena<T>) -> ReverseChildren<'_, T> ⓘ
Return an iterator of references to this node’s children, in reverse order.
Sourcepub fn descendants<T>(self, arena: &Arena<T>) -> Descendants<'_, T> ⓘ
pub fn descendants<T>(self, arena: &Arena<T>) -> Descendants<'_, T> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Parent nodes appear before the descendants.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub fn traverse<T>(self, arena: &Arena<T>) -> Traverse<'_, T> ⓘ
pub fn traverse<T>(self, arena: &Arena<T>) -> Traverse<'_, T> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Sourcepub fn reverse_traverse<T>(self, arena: &Arena<T>) -> ReverseTraverse<'_, T> ⓘ
pub fn reverse_traverse<T>(self, arena: &Arena<T>) -> ReverseTraverse<'_, T> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Sourcepub fn detach<T>(self, arena: &mut Arena<T>)
pub fn detach<T>(self, arena: &mut Arena<T>)
Detach a node from its parent and siblings. Children are not affected.
Sourcepub fn append<T>(
self,
new_child: NodeId,
arena: &mut Arena<T>,
) -> Result<(), IndexTreeError>
pub fn append<T>( self, new_child: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>
Append a new child to this node, after existing children.
Sourcepub fn prepend<T>(
self,
new_child: NodeId,
arena: &mut Arena<T>,
) -> Result<(), IndexTreeError>
pub fn prepend<T>( self, new_child: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>
Prepend a new child to this node, before existing children.
Sourcepub fn insert_after<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>,
) -> Result<(), IndexTreeError>
pub fn insert_after<T>( self, new_sibling: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>
Insert a new sibling after this node.
Sourcepub fn insert_before<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>,
) -> Result<(), IndexTreeError>
pub fn insert_before<T>( self, new_sibling: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>
Insert a new sibling before this node.