pub struct Tree<Payload, MetaData, Edge> { /* private fields */ }Implementations§
Source§impl<P, D, E> Tree<P, D, E>
impl<P, D, E> Tree<P, D, E>
Source§impl<P, D, E> Tree<P, D, E>
impl<P, D, E> Tree<P, D, E>
pub fn with_metadata(metadata: D) -> Tree<P, D, E>
pub fn metadata(&self) -> &D
pub fn metadata_mut(&mut self) -> &mut D
pub fn get(&self, n: usize) -> Result<&Node<P, E>, Error>
pub fn get_mut(&mut self, n: usize) -> Result<&mut Node<P, E>, Error>
pub fn set_root(&mut self, new_root: usize)
pub fn root(&self) -> usize
pub fn is_root(&self, n: usize) -> bool
pub fn nodes(&self) -> impl Iterator<Item = usize>
pub fn leaves(&self) -> impl Iterator<Item = usize>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn nodes_mut(&mut self) -> impl Iterator<Item = &mut Node<P, E>>
pub fn add_node(&mut self, parent: Option<usize>, data: P) -> usize
pub fn plug(&mut self, target: usize, n: usize)
pub fn unplug(&mut self, n: usize)
pub fn delete_node(&mut self, n: usize) -> Option<()>
pub fn delete_nodes(&mut self, ns: &[usize]) -> Option<()>
pub fn move_node(&mut self, n: usize, dest: usize)
pub fn print<NodeFormatter, S1, EdgeFormatter, S2>( &self, f: NodeFormatter, g: EdgeFormatter, )
pub fn parent(&self, n: usize) -> Option<usize>
pub fn find_leaf<F>(&self, f: F) -> Option<usize>
pub fn find_node<F>(&self, f: F) -> Option<usize>
pub fn find_child<F>(&self, n: usize, f: F) -> Result<Option<usize>, Error>
Sourcepub fn mrca(
&self,
nodes: impl IntoIterator<Item = usize>,
) -> Result<usize, Error>
pub fn mrca( &self, nodes: impl IntoIterator<Item = usize>, ) -> Result<usize, Error>
Compute the Most Recent Common Ancestor of a set of nodes. If the set is empty, return the tree root.
pub fn ascendance(&self, n: usize) -> Vec<usize>
pub fn descendants(&self, n: usize) -> Vec<usize>
pub fn leave_set_of( &self, n: usize, ) -> HashSet<usize, BuildHasherDefault<IdentityHasher<usize>>>
pub fn leaves_of(&self, n: usize) -> Vec<usize>
pub fn cache_descendants(&mut self)
pub fn cache_descendants_of(&mut self, from: usize)
pub fn cached_descendants(&self, n: usize) -> Option<&Vec<usize>>
pub fn cache_leaves(&mut self)
pub fn cached_leaves_of( &self, n: usize, ) -> &HashSet<usize, BuildHasherDefault<IdentityHasher<usize>>>
pub fn cached_leaves_of_vec(&self, n: usize) -> Vec<usize>
pub fn children(&self, n: usize) -> Result<&[usize], Error>
pub fn siblings(&self, n: usize) -> Vec<usize>
pub fn depth(&self) -> f32
pub fn node_depth<Measure>(&self, n: usize, f: &Measure) -> f32
Sourcepub fn node_topological_depth(&self, n: usize) -> Result<i64, Error>
pub fn node_topological_depth(&self, n: usize) -> Result<i64, Error>
Returns the topological depth of the
pub fn topological_depth(&self) -> (usize, usize)
pub fn for_each_leave<F>(&self, f: &mut F)
pub fn for_each_leave_mut<F>(&mut self, f: &mut F)
pub fn inners(&self) -> impl Iterator<Item = usize>
pub fn prune_by<U>(&mut self, is_useless: &U)
pub fn prune(&mut self, is_empty: impl Fn(&P) -> bool)
pub fn sort_by<K>(&mut self, k: impl Fn(&P) -> K)
pub fn sort_leaves_by<K>(&mut self, k: impl Fn(&P) -> K)
Trait Implementations§
Auto Trait Implementations§
impl<Payload, MetaData, Edge> Freeze for Tree<Payload, MetaData, Edge>where
MetaData: Freeze,
impl<Payload, MetaData, Edge> RefUnwindSafe for Tree<Payload, MetaData, Edge>
impl<Payload, MetaData, Edge> Send for Tree<Payload, MetaData, Edge>
impl<Payload, MetaData, Edge> Sync for Tree<Payload, MetaData, Edge>
impl<Payload, MetaData, Edge> Unpin for Tree<Payload, MetaData, Edge>
impl<Payload, MetaData, Edge> UnwindSafe for Tree<Payload, MetaData, Edge>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more