Traversable

Trait Traversable 

Source
pub trait Traversable<V, Ix = DefaultIndexType>
where V: ValueType, Ix: IndexType,
{ // Required methods fn root(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>; fn value(&self, node: NodeIndex<Ix>) -> Option<&V>; fn value_mut(&mut self, node: NodeIndex<Ix>) -> Option<&mut V>; fn parent(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>; fn child(&self, node: NodeIndex<Ix>, pos: usize) -> Option<NodeIndex<Ix>>; fn child_count(&self, node: NodeIndex<Ix>) -> usize; fn node_count(&self) -> usize; }
Expand description

This trait defines the interface for using the traversal iterators provided by this module.

Required Methods§

Source

fn root(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>

Returns the index of the root node of the tree containing the tree node indexed by node.

Source

fn value(&self, node: NodeIndex<Ix>) -> Option<&V>

Immutably access the value stored in the tree node indexed by node.

Source

fn value_mut(&mut self, node: NodeIndex<Ix>) -> Option<&mut V>

Mutably access the value stored in the tree node indexed by node.

Source

fn parent(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>

Returns the index of parent node tree node indexed by node.

Source

fn child(&self, node: NodeIndex<Ix>, pos: usize) -> Option<NodeIndex<Ix>>

Returns the index of the child node at position pos of the tree node indexed by node.

Source

fn child_count(&self, node: NodeIndex<Ix>) -> usize

Returns the number of child nodes of the tree node indexed by node.

Source

fn node_count(&self) -> usize

Returns the total number of tree nodes of the tree self.

Implementors§

Source§

impl<K, V> Traversable<V> for AaTree<K, V>
where K: KeyType, V: ValueType,

Source§

impl<K, V, W> Traversable<V> for WeightedAaTree<K, V, W>
where K: KeyType, V: ValueType, W: WeightType,

Source§

impl<V> Traversable<V> for AaForest<V>
where V: ValueType,

Source§

impl<V> Traversable<V> for Forest<V>
where V: ValueType,

Source§

impl<V, W> Traversable<V> for WeightedAaForest<V, W>
where V: ValueType, W: WeightType,