pub struct TreeNode {
pub id: String,
pub label: String,
pub node_type: String,
pub children: Vec<TreeNode>,
pub attributes: HashMap<String, String>,
pub size: Option<Size>,
}Expand description
Tree node for visualization
Fields§
§id: String§label: String§node_type: String§children: Vec<TreeNode>§attributes: HashMap<String, String>§size: Option<Size>Implementations§
Source§impl TreeNode
impl TreeNode
pub fn new(id: String, label: String, node_type: String) -> Self
pub fn with_child(self, child: TreeNode) -> Self
pub fn with_children(self, children: Vec<TreeNode>) -> Self
pub fn with_attribute(self, key: String, value: String) -> Self
pub fn with_size(self, size: Size) -> Self
pub fn is_leaf(&self) -> bool
pub fn depth(&self) -> usize
pub fn node_count(&self) -> usize
pub fn leaf_count(&self) -> usize
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TreeNode
impl<'de> Deserialize<'de> for TreeNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TreeNode
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnwindSafe for TreeNode
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