pub trait Traversable<V, Ix = DefaultIndexType>{
// 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§
Sourcefn root(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>
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
.
Sourcefn value(&self, node: NodeIndex<Ix>) -> Option<&V>
fn value(&self, node: NodeIndex<Ix>) -> Option<&V>
Immutably access the value stored in the tree node indexed by node
.
Sourcefn value_mut(&mut self, node: NodeIndex<Ix>) -> Option<&mut V>
fn value_mut(&mut self, node: NodeIndex<Ix>) -> Option<&mut V>
Mutably access the value stored in the tree node indexed by node
.
Sourcefn parent(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>
fn parent(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>
Returns the index of parent node tree node indexed by node
.
Sourcefn child(&self, node: NodeIndex<Ix>, pos: usize) -> Option<NodeIndex<Ix>>
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
.
Sourcefn child_count(&self, node: NodeIndex<Ix>) -> usize
fn child_count(&self, node: NodeIndex<Ix>) -> usize
Returns the number of child nodes of the tree node indexed by node
.
Sourcefn node_count(&self) -> usize
fn node_count(&self) -> usize
Returns the total number of tree nodes of the tree self
.