Struct mod3d_base::hierarchy::Hierarchy
source · pub struct Hierarchy<T>where
T: Debug,{ /* private fields */ }Expand description
A hierarchy of nodes, each of which has a data of the type of the tree
Implementations§
source§impl<T> Hierarchy<T>where
T: Debug,
impl<T> Hierarchy<T>where
T: Debug,
sourcepub fn relate(&mut self, parent: usize, child: usize)
pub fn relate(&mut self, parent: usize, child: usize)
Add a relation from a parent to a child in the hierarchy
sourcepub fn find_roots(&mut self)
pub fn find_roots(&mut self)
Find all the roots of the hierarchy and record it
sourcepub fn borrow_node(&self, index: usize) -> &T
pub fn borrow_node(&self, index: usize) -> &T
Borrow a node in the hierarchy
sourcepub fn borrow_mut(&mut self) -> (&Vec<usize>, &mut Vec<Node<T>>)
pub fn borrow_mut(&mut self) -> (&Vec<usize>, &mut Vec<Node<T>>)
Mutuably borrow a node in the hierarchy
sourcepub fn borrow_roots(&self) -> &Vec<usize>
pub fn borrow_roots(&self) -> &Vec<usize>
Borrow the roots of the hierarchy
sourcepub fn enum_from(&self, node: usize) -> NodeEnum<'_, T> ⓘ
pub fn enum_from(&self, node: usize) -> NodeEnum<'_, T> ⓘ
Enumerate the nodes from a particular node
sourcepub fn iter_from(&self, node: usize) -> NodeIter<'_, T> ⓘ
pub fn iter_from(&self, node: usize) -> NodeIter<'_, T> ⓘ
Iterate the nodes from a particular node
sourcepub fn borrow_elements(&self) -> &Vec<Node<T>>
pub fn borrow_elements(&self) -> &Vec<Node<T>>
Borrow all the elements
sourcepub fn take_elements(self) -> Vec<T>
pub fn take_elements(self) -> Vec<T>
Take the elements as a vec
Trait Implementations§
source§impl<'a, Opt, T> IndentedDisplay<'a, Opt> for Hierarchy<T>
impl<'a, Opt, T> IndentedDisplay<'a, Opt> for Hierarchy<T>
Auto Trait Implementations§
impl<T> Freeze for Hierarchy<T>
impl<T> RefUnwindSafe for Hierarchy<T>where
T: RefUnwindSafe,
impl<T> Send for Hierarchy<T>where
T: Send,
impl<T> Sync for Hierarchy<T>where
T: Sync,
impl<T> Unpin for Hierarchy<T>where
T: Unpin,
impl<T> UnwindSafe for Hierarchy<T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)