pub struct VecTree<T> { /* private fields */ }
Implementations
sourceimpl<T> VecTree<T>
impl<T> VecTree<T>
pub fn new() -> VecTree<T>
pub fn with_capacity(n: usize) -> VecTree<T>
pub fn reserve(&mut self, additional_capacity: usize)
pub fn try_insert(&mut self, data: T, parent_id: Index) -> Result<Index, T>
pub fn insert(&mut self, data: T, parent_id: Index) -> Index
pub fn try_insert_root(&mut self, data: T) -> Result<Index, T>
pub fn insert_root(&mut self, data: T) -> Index
pub fn remove(&mut self, node_id: Index) -> Option<T>
pub fn contains(&self, i: Index) -> bool
pub fn append_child(&mut self, node_id: Index, new_child_id: Index)
pub fn detach(&mut self, node_id: Index)
pub fn get(&self, node_id: Index) -> Option<&T>
pub fn get_mut(&mut self, node_id: Index) -> Option<&mut T>
pub fn get_root_index(&self) -> Option<Index>
pub fn capacity(&self) -> usize
pub fn clear(&mut self)
pub fn parent(&self, node_id: Index) -> Option<Index>
sourcepub fn children(&self, node_id: Index) -> ChildrenIter<'_, T> ⓘ
pub fn children(&self, node_id: Index) -> ChildrenIter<'_, T> ⓘ
Return an iterator of references to this node’s children.
sourcepub fn preceding_siblings(&self, node_id: Index) -> PrecedingSiblingsIter<'_, T> ⓘ
pub fn preceding_siblings(&self, node_id: Index) -> PrecedingSiblingsIter<'_, T> ⓘ
Return an iterator of references to this node and the siblings before it.
Call .next().unwrap()
once on the iterator to skip the node itself.
sourcepub fn following_siblings(&self, node_id: Index) -> FollowingSiblingsIter<'_, T> ⓘ
pub fn following_siblings(&self, node_id: Index) -> FollowingSiblingsIter<'_, T> ⓘ
Return an iterator of references to this node and the siblings after it.
Call .next().unwrap()
once on the iterator to skip the node itself.
sourcepub fn ancestors(&self, node_id: Index) -> AncestorsIter<'_, T> ⓘ
pub fn ancestors(&self, node_id: Index) -> AncestorsIter<'_, T> ⓘ
Return an iterator of references to this node and its ancestors.
Call .next().unwrap()
once on the iterator to skip the node itself.
sourcepub fn descendants(&self, node_id: Index) -> DescendantsIter<'_, T> ⓘ
pub fn descendants(&self, node_id: Index) -> DescendantsIter<'_, T> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Parent nodes appear before the descendants.
Call .next().unwrap()
once on the iterator to skip the node itself.
sourcepub fn descendants_with_depth(
&self,
node_id: Index
) -> DescendantsWithDepthIter<'_, T> ⓘ
pub fn descendants_with_depth(
&self,
node_id: Index
) -> DescendantsWithDepthIter<'_, T> ⓘ
Return an iterator of references to this node and its descendants, with deoth in the tree, in tree order.
Parent nodes appear before the descendants.
Call .next().unwrap()
once on the iterator to skip the node itself.