pub struct NodeTree { /* private fields */ }Expand description
Hierarchical node tree managing node lifecycles and parent-child relationships.
Nodes are stored with ownership in the tree; removing or dropping a node subtree automatically cleans up associated child nodes and script attachments.
Implementations§
Source§impl NodeTree
impl NodeTree
Sourcepub fn insert(&mut self, desc: NodeDesc) -> Result<()>
pub fn insert(&mut self, desc: NodeDesc) -> Result<()>
Inserts a node into the tree from a NodeDesc.
Validates node ID uniqueness and updates parent-child links. If no root has been established and the node has no parent, it is designated as the root.
pub fn get(&self, id: &NodeId) -> Option<&Node>
pub fn contains(&self, id: &NodeId) -> bool
pub fn children_of(&self, id: &NodeId) -> Vec<NodeId>
pub fn get_mut(&mut self, id: &NodeId) -> Option<&mut Node>
pub fn iter(&self) -> impl Iterator<Item = &Node>
pub fn root(&self) -> Option<&NodeId>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn remove(&mut self, id: &NodeId) -> Result<()>
pub fn reparent( &mut self, id: &NodeId, new_parent: Option<NodeId>, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Forget for NodeTree
impl Freeze for NodeTree
impl Move for NodeTree
impl RefUnwindSafe for NodeTree
impl Send for NodeTree
impl Sync for NodeTree
impl Unpin for NodeTree
impl UnsafeUnpin for NodeTree
impl UnwindSafe for NodeTree
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