Trait HasChildren

Source
pub trait HasChildren<'a, T> {
    // Required methods
    fn children(&self) -> &[Node<'a, T>];
    fn is_empty(&self) -> bool;
    fn len(&self) -> usize;
    fn iter(&self) -> Iter<'_, Node<'a, T>>;
    fn at(&self, index: usize) -> &Node<'a, T>;
}
Expand description

A trait for types that have child nodes.

This trait primarily exists for documentation purposes. Consider calling children before writing generic code over this trait.

Required Methods§

Source

fn children(&self) -> &[Node<'a, T>]

Returns a reference to the child nodes.

Source

fn is_empty(&self) -> bool

Returns true if this node has no children, false otherwise.

Source

fn len(&self) -> usize

Returns the number of child nodes.

Source

fn iter(&self) -> Iter<'_, Node<'a, T>>

Returns an iterator over references to the child nodes.

Source

fn at(&self, index: usize) -> &Node<'a, T>

Returns a reference to the child node at the given index.

Implementors§

Source§

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

Source§

impl<'a, T> HasChildren<'a, T> for NodeChildrenMut<'a, '_, T>

Source§

impl<'a, T> HasChildren<'a, T> for NodeMut<'a, '_, T>

Source§

impl<'a, T> HasChildren<'a, T> for SlidingTree<'a, T>