Struct rctree::Node [−][src]
pub struct Node<T>(_);
Expand description
A reference to a node holding a value of type T
. Nodes form a tree.
Internally, this uses reference counting for lifetime tracking
and std::cell::RefCell
for interior mutability.
Note: Cloning a Node
only increments a reference count. It does not copy the data.
Implementations
Returns a parent node, unless this node is the root of the tree.
Panics
Panics if the node is currently mutably borrowed.
Returns a first child of this node, unless it has no child.
Panics
Panics if the node is currently mutably borrowed.
Returns a last child of this node, unless it has no child.
Panics
Panics if the node is currently mutably borrowed.
Returns the previous sibling of this node, unless it is a first child.
Panics
Panics if the node is currently mutably borrowed.
Returns the next sibling of this node, unless it is a last child.
Panics
Panics if the node is currently mutably borrowed.
Returns a shared reference to this node’s data
Panics
Panics if the node is currently mutably borrowed.
Returns a unique/mutable reference to this node’s data
Panics
Panics if the node is currently borrowed.
Returns an iterator of nodes to this node and its ancestors.
Includes the current node.
pub fn preceding_siblings(&self) -> PrecedingSiblings<T>ⓘNotable traits for PrecedingSiblings<T>
impl<T> Iterator for PrecedingSiblings<T> type Item = Node<T>;
pub fn preceding_siblings(&self) -> PrecedingSiblings<T>ⓘNotable traits for PrecedingSiblings<T>
impl<T> Iterator for PrecedingSiblings<T> type Item = Node<T>;
Returns an iterator of nodes to this node and the siblings before it.
Includes the current node.
pub fn following_siblings(&self) -> FollowingSiblings<T>ⓘNotable traits for FollowingSiblings<T>
impl<T> Iterator for FollowingSiblings<T> type Item = Node<T>;
pub fn following_siblings(&self) -> FollowingSiblings<T>ⓘNotable traits for FollowingSiblings<T>
impl<T> Iterator for FollowingSiblings<T> type Item = Node<T>;
Returns an iterator of nodes to this node and the siblings after it.
Includes the current node.
Returns an iterator of nodes to this node’s children.
Panics
Panics if the node is currently mutably borrowed.
Returns true
if this node has children nodes.
Panics
Panics if the node is currently mutably borrowed.
pub fn descendants(&self) -> Descendants<T>ⓘNotable traits for Descendants<T>
impl<T> Iterator for Descendants<T> type Item = Node<T>;
pub fn descendants(&self) -> Descendants<T>ⓘNotable traits for Descendants<T>
impl<T> Iterator for Descendants<T> type Item = Node<T>;
Returns an iterator of nodes to this node and its descendants, in tree order.
Includes the current node.
Returns an iterator of nodes to this node and its descendants, in tree order.
Detaches a node from its parent and siblings. Children are not affected.
Panics
Panics if the node or one of its adjoining nodes is currently borrowed.
Appends a new child to this node, after existing children.
Panics
Panics if the node, the new child, or one of their adjoining nodes is currently borrowed.
Prepends a new child to this node, before existing children.
Panics
Panics if the node, the new child, or one of their adjoining nodes is currently borrowed.
Inserts a new sibling after this node.
Panics
Panics if the node, the new sibling, or one of their adjoining nodes is currently borrowed.
Inserts a new sibling before this node.
Panics
Panics if the node, the new sibling, or one of their adjoining nodes is currently borrowed.
Returns a copy of a current node without children.
Panics
Panics if the node is currently mutably borrowed.
Returns a copy of a current node with children.
Panics
Panics if any of the descendant nodes are currently mutably borrowed.
Trait Implementations
Cloning a Node
only increments a reference count. It does not copy the data.
Auto Trait Implementations
impl<T> !RefUnwindSafe for Node<T>
impl<T> !UnwindSafe for Node<T>
Blanket Implementations
Mutably borrows from an owned value. Read more