Struct indextree::NodeId [−][src]
pub struct NodeId { /* fields omitted */ }
A node identifier within a particular Arena
Methods
impl NodeId
[src]
impl NodeId
pub fn new(index: usize) -> Self
[src]
pub fn new(index: usize) -> Self
Create a NodeId
used for attempting to get Node
s references from an
Arena
.
ⓘImportant traits for Ancestors<'a, T>pub fn ancestors<T>(self, arena: &Arena<T>) -> Ancestors<T>
[src]
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.
ⓘImportant traits for PrecedingSiblings<'a, T>pub fn preceding_siblings<T>(self, arena: &Arena<T>) -> PrecedingSiblings<T>
[src]
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.
ⓘImportant traits for FollowingSiblings<'a, T>pub fn following_siblings<T>(self, arena: &Arena<T>) -> FollowingSiblings<T>
[src]
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.
ⓘImportant traits for Children<'a, T>pub fn children<T>(self, arena: &Arena<T>) -> Children<T>
[src]
pub fn children<T>(self, arena: &Arena<T>) -> Children<T>
Return an iterator of references to this node’s children.
ⓘImportant traits for ReverseChildren<'a, T>pub fn reverse_children<T>(self, arena: &Arena<T>) -> ReverseChildren<T>
[src]
pub fn reverse_children<T>(self, arena: &Arena<T>) -> ReverseChildren<T>
Return an iterator of references to this node’s children, in reverse order.
ⓘImportant traits for Descendants<'a, T>pub fn descendants<T>(self, arena: &Arena<T>) -> Descendants<T>
[src]
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.
ⓘImportant traits for Traverse<'a, T>pub fn traverse<T>(self, arena: &Arena<T>) -> Traverse<T>
[src]
pub fn traverse<T>(self, arena: &Arena<T>) -> Traverse<T>
Return an iterator of references to this node and its descendants, in tree order.
ⓘImportant traits for ReverseTraverse<'a, T>pub fn reverse_traverse<T>(self, arena: &Arena<T>) -> ReverseTraverse<T>
[src]
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.
pub fn detach<T>(self, arena: &mut Arena<T>)
[src]
pub fn detach<T>(self, arena: &mut Arena<T>)
Detach a node from its parent and siblings. Children are not affected.
pub fn append<T>(self, new_child: NodeId, arena: &mut Arena<T>) -> Fallible<()>
[src]
pub fn append<T>(self, new_child: NodeId, arena: &mut Arena<T>) -> Fallible<()>
Append a new child to this node, after existing children.
pub fn prepend<T>(self, new_child: NodeId, arena: &mut Arena<T>) -> Fallible<()>
[src]
pub fn prepend<T>(self, new_child: NodeId, arena: &mut Arena<T>) -> Fallible<()>
Prepend a new child to this node, before existing children.
pub fn insert_after<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
[src]
pub fn insert_after<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
Insert a new sibling after this node.
pub fn insert_before<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
[src]
pub fn insert_before<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
Insert a new sibling before this node. success.
pub fn remove<T>(self, arena: &mut Arena<T>) -> Fallible<()>
[src]
pub fn remove<T>(self, arena: &mut Arena<T>) -> Fallible<()>
Remove a node from the arena. Available children of the removed node will be append to the parent after the previous sibling if available.
Please note that the node will not be removed from the internal arena
storage, but marked as removed
. Traversing the arena returns a
the plain iterator and contains removed elements too.
Trait Implementations
impl PartialEq for NodeId
[src]
impl PartialEq for NodeId
fn eq(&self, other: &NodeId) -> bool
[src]
fn eq(&self, other: &NodeId) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &NodeId) -> bool
[src]
fn ne(&self, other: &NodeId) -> bool
This method tests for !=
.
impl Eq for NodeId
[src]
impl Eq for NodeId
impl PartialOrd for NodeId
[src]
impl PartialOrd for NodeId
fn partial_cmp(&self, other: &NodeId) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &NodeId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &NodeId) -> bool
[src]
fn lt(&self, other: &NodeId) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &NodeId) -> bool
[src]
fn le(&self, other: &NodeId) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &NodeId) -> bool
[src]
fn gt(&self, other: &NodeId) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &NodeId) -> bool
[src]
fn ge(&self, other: &NodeId) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for NodeId
[src]
impl Ord for NodeId
fn cmp(&self, other: &NodeId) -> Ordering
[src]
fn cmp(&self, other: &NodeId) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Copy for NodeId
[src]
impl Copy for NodeId
impl Clone for NodeId
[src]
impl Clone for NodeId
fn clone(&self) -> NodeId
[src]
fn clone(&self) -> NodeId
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for NodeId
[src]
impl Debug for NodeId
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Hash for NodeId
[src]
impl Hash for NodeId
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for NodeId
[src]
impl Display for NodeId
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Index<NodeId> for Arena<T>
[src]
impl<T> Index<NodeId> for Arena<T>
type Output = Node<T>
The returned type after indexing.
fn index(&self, node: NodeId) -> &Node<T>
[src]
fn index(&self, node: NodeId) -> &Node<T>
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<NodeId> for Arena<T>
[src]
impl<T> IndexMut<NodeId> for Arena<T>