Struct ego_tree::NodeMut
[−]
[src]
pub struct NodeMut<'a, T: 'a> { /* fields omitted */ }
A node mutator.
Methods
impl<'a, T: 'a> NodeMut<'a, T>
[src]
fn value(&mut self) -> &mut T
Returns the value of this node.
fn id(&self) -> NodeId<T>
Returns the ID of this node.
fn parent(&mut self) -> Option<NodeMut<T>>
Returns a mutator of this node's parent.
fn prev_sibling(&mut self) -> Option<NodeMut<T>>
Returns a mutator of this node's previous sibling.
fn next_sibling(&mut self) -> Option<NodeMut<T>>
Returns a mutator of this node's next sibling.
fn first_child(&mut self) -> Option<NodeMut<T>>
Returns a mutator of this node's first child.
fn last_child(&mut self) -> Option<NodeMut<T>>
Returns a mutator of this node's last child.
fn has_siblings(&self) -> bool
Returns true if this node has siblings.
fn has_children(&self) -> bool
Returns true if this node has children.
fn append(&mut self, value: T) -> NodeMut<T>
Appends a new node to this node's children, returning a mutator of the new node.
fn prepend(&mut self, value: T) -> NodeMut<T>
Prepends a new node to this node's children, returning a mutator of the new node.
fn insert_before(&mut self, value: T) -> NodeMut<T>
Inserts a new sibling before this node, returning a mutator of the new node.
Panics
Panics if this node is an orphan.
fn insert_after(&mut self, value: T) -> NodeMut<T>
Inserts a new sibling after this node, returning a mutator of the new node.
Panics
Panics if this node is an orphan.
fn detach(&mut self)
Detaches this node from its parent.
If this node is an orphan, does nothing.
unsafe fn append_id(&mut self, id: NodeId<T>) -> NodeMut<T>
Appends a node to this node's children by ID, returning a mutator of the referenced node.
May cause cycles, which can cause unsafety in other operations.
Panics
Panics if id
does not refer to a node in this tree.
unsafe fn prepend_id(&mut self, id: NodeId<T>) -> NodeMut<T>
Prepends a node to this node's children by ID, returning a mutator of the referenced node.
May cause cycles, which can cause unsafety in other operations.
Panics
Panics if id
does not refer to a node in this tree.
unsafe fn insert_id_before(&mut self, id: NodeId<T>) -> NodeMut<T>
Inserts a sibling before this node by ID, returning a mutator of the referenced node.
May cause cycles, which can cause unsafety in other operations.
Panics
Panics if id
does not refer to a node in this tree.
unsafe fn insert_id_after(&mut self, id: NodeId<T>) -> NodeMut<T>
Inserts a sibling after this node by ID, returning a mutator of the referenced node.
May cause cycles, which can cause unsafety in other operations.
Panics
Panics if id
does not refer to a node in this tree.
unsafe fn reparent_from_id_append(&mut self, id: NodeId<T>)
Reparents the children of a node by ID, appending them to this node's children.
If the referenced node does not have children, does nothing.
May cause cycles, which can cause unsafety in other operations.
Panics
Panics if id
does not refer to a node in this tree.
unsafe fn reparent_from_id_prepend(&mut self, id: NodeId<T>)
Reparents the children of a node by ID, prepending them to this node's children.
If the referenced node does not have children, does nothing.
May cause cycles, which can cause unsafety in other operations.
Panics
Panics if id
does not refer to a node in this tree.