pub struct Tree<T> { /* private fields */ }
Implementations
sourceimpl<T> Tree<T>
impl<T> Tree<T>
pub fn iter(&self) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
pub fn iter_from(&self, id: &NodeId) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
pub fn iter_mut(&mut self) -> IterMut<'_, T>ⓘNotable traits for IterMut<'a, T>impl<'a, T> Iterator for IterMut<'a, T> type Item = &'a mut T;
pub fn into_iterator(self) -> IntoIter<T>ⓘNotable traits for IntoIter<T>impl<T> Iterator for IntoIter<T> type Item = T;
sourceimpl<T> Tree<T>
impl<T> Tree<T>
sourcepub fn make_child(&mut self, child: &NodeId, parent: &NodeId) -> Result<(), Error>
pub fn make_child(&mut self, child: &NodeId, parent: &NodeId) -> Result<(), Error>
Make the child
nodes as the last child of the parent
node.
Errors
- Fails of the same
NodeId
is passed - TODO: Fail if the child node is parent of the parent node.
sourcepub fn make_prev_siblings(
&mut self,
node: &NodeId,
sibling: &NodeId
) -> Result<(), Error>
pub fn make_prev_siblings(
&mut self,
node: &NodeId,
sibling: &NodeId
) -> Result<(), Error>
Make the node
as the previous sibling of sibling
Errors
- Fails of the same
NodeId
is passed - TODO: Fail if the child node is parent of the parent node.
sourceimpl<T> Tree<T>
impl<T> Tree<T>
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new tree with a specific parameter.
sourcepub fn create_node(&mut self, value: T) -> NodeId
pub fn create_node(&mut self, value: T) -> NodeId
Add a node to the tree, without relations with the other nodes.
pub fn first_node_id(&self) -> Option<NodeId>
pub fn last_node_id(&self) -> Option<NodeId>
sourcepub fn append_child(&mut self, value: T) -> NodeId
pub fn append_child(&mut self, value: T) -> NodeId
Appends the value to the last element of the three as its child. If None creates a new root.
sourcepub fn append_sibling(&mut self, value: T) -> NodeId
pub fn append_sibling(&mut self, value: T) -> NodeId
Appends the value to the last element of the three as its sibling. If None creates a new root.
Trait Implementations
sourceimpl<'a, T> IntoIterator for &'a Tree<T>
impl<'a, T> IntoIterator for &'a Tree<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Tree<T>where
T: RefUnwindSafe,
impl<T> Send for Tree<T>where
T: Send,
impl<T> Sync for Tree<T>where
T: Sync,
impl<T> Unpin for Tree<T>where
T: Unpin,
impl<T> UnwindSafe for Tree<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more