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

Creates a new node from its associated data.

Returns a weak referece to a node.

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.

Returns an iterator of nodes to this node and the siblings before it.

Includes the current node.

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.

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.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.