[][src]Struct read_tree::Node

pub struct Node<'a, T> { /* fields omitted */ }

A slice of a Tree.

A node is essentially the same as a tree, only that it does not own its data. You can navigate a node using iterators.

Methods

impl<'a, T> Node<'a, T>[src]

pub fn data(&self) -> &T[src]

Returns a reference to the payload of the node.

pub fn depth(&self) -> usize[src]

Returns the depth of the node within the tree. The root node returns depth 0.

pub fn len(&self) -> usize[src]

Returns the number of nodes within the subtree of this node.

The count includes the node itself; a leaf node returns length 1.

pub fn is_leaf(&self) -> bool[src]

Returns true if the node has no child nodes.

Important traits for Descendants<'a, T>
pub fn iter(&self) -> Descendants<'a, T>[src]

Returns a depth first iterator of nodes. It iterates all nodes in the subtree of the node, including the node itself. See Descendants for more information.

Important traits for Children<'a, T>
pub fn children(&self) -> Children<'a, T>[src]

Returns an iterator over the child nodes of the node. See Children for more information.

impl<'a, T: Clone> Node<'a, T>[src]

pub fn into_tree(self) -> Tree<T>[src]

Clones the subtree of the node into a new tree.

This step may be expensive and should be avoided if possible.

Trait Implementations

impl<'a, T: Debug> Debug for Node<'a, T>[src]

Auto Trait Implementations

impl<'a, T> Send for Node<'a, T> where
    T: Sync

impl<'a, T> Sync for Node<'a, T> where
    T: Sync

impl<'a, T> Unpin for Node<'a, T>

impl<'a, T> UnwindSafe for Node<'a, T> where
    T: RefUnwindSafe

impl<'a, T> RefUnwindSafe for Node<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]