[−][src]Struct read_tree::Node
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
Auto Trait Implementations
impl<'a, T> Send for Node<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Sync for Node<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Node<'a, T>
impl<'a, T> UnwindSafe for Node<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> RefUnwindSafe for Node<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,