pub struct Tree {
pub guid: Uuid,
pub name: String,
root_node: Option<TreeNode>,
}
Fields§
§guid: Uuid
§name: String
§root_node: Option<TreeNode>
Implementations§
Source§impl Tree
impl Tree
pub fn new(name: &str) -> Self
pub fn root(&self) -> Option<TreeNode>
pub fn add(&mut self, node: &TreeNode, parent: Option<&TreeNode>)
pub fn nodes(&self) -> Vec<TreeNode>
pub fn remove(&mut self, node: &TreeNode) -> bool
fn find_parent_of_node(&self, node_guid: &Uuid) -> Option<TreeNode>
fn find_parent_recursive( node: &TreeNode, target_guid: &Uuid, ) -> Option<TreeNode>
pub fn leaves(&self) -> Vec<TreeNode>
pub fn traverse(&self, strategy: &str, order: &str) -> Vec<TreeNode>
pub fn get_node_by_name(&self, node_name: &str) -> Option<TreeNode>
pub fn get_nodes_by_name(&self, node_name: &str) -> Vec<TreeNode>
pub fn find_node_by_guid(&self, node_guid: &Uuid) -> Option<TreeNode>
pub fn add_child_by_guid( &mut self, parent_guid: &Uuid, child_guid: &Uuid, ) -> bool
pub fn get_children_guids(&self, node_guid: &Uuid) -> Vec<Uuid>
pub fn print_hierarchy(&self)
fn print_node(node: &TreeNode, level: usize)
pub fn to_json_data(&self) -> Result<String, Box<dyn Error>>
pub fn from_json_data(json_data: &str) -> Result<Self, Box<dyn Error>>
pub fn to_json(&self, filepath: &str) -> Result<(), Box<dyn Error>>
pub fn from_json(filepath: &str) -> Result<Self, Box<dyn Error>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl !RefUnwindSafe for Tree
impl !Send for Tree
impl !Sync for Tree
impl Unpin for Tree
impl !UnwindSafe for Tree
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