pub struct TreeNode {
pub node_type: NodeType,
pub content: String,
pub location: Option<Location>,
pub children: Vec<TreeNode>,
}Expand description
A node in the reference tree
Fields§
§node_type: NodeType§content: String§location: Option<Location>§children: Vec<TreeNode>Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn with_location(
node_type: NodeType,
content: String,
location: Location,
) -> Self
pub fn with_location( node_type: NodeType, content: String, location: Location, ) -> Self
Create a TreeNode with a location
Sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Check if this node has children
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Get the number of children
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get the total number of nodes in the tree (including this node)
Trait Implementations§
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