pub struct NodeMut<'a, T: 'a> { /* private fields */ }
Expand description
Node mutator.
Implementations§
source§impl<'a, T: 'a> NodeMut<'a, T>
impl<'a, T: 'a> NodeMut<'a, T>
sourcepub fn into_parent(self) -> Result<Self, Self>
pub fn into_parent(self) -> Result<Self, Self>
Returns the parent of this node.
Returns Ok(parent)
if possible and Err(self)
otherwise
so the caller can recover the current position.
sourcepub fn prev_sibling(&mut self) -> Option<NodeMut<'_, T>>
pub fn prev_sibling(&mut self) -> Option<NodeMut<'_, T>>
Returns the previous sibling of this node.
sourcepub fn into_prev_sibling(self) -> Result<Self, Self>
pub fn into_prev_sibling(self) -> Result<Self, Self>
Returns the previous sibling of this node.
Returns Ok(prev_sibling)
if possible and Err(self)
otherwise
so the caller can recover the current position.
sourcepub fn next_sibling(&mut self) -> Option<NodeMut<'_, T>>
pub fn next_sibling(&mut self) -> Option<NodeMut<'_, T>>
Returns the next sibling of this node.
sourcepub fn into_next_sibling(self) -> Result<Self, Self>
pub fn into_next_sibling(self) -> Result<Self, Self>
Returns the next sibling of this node.
Returns Ok(next_sibling)
if possible and Err(self)
otherwise
so the caller can recover the current position.
sourcepub fn first_child(&mut self) -> Option<NodeMut<'_, T>>
pub fn first_child(&mut self) -> Option<NodeMut<'_, T>>
Returns the first child of this node.
sourcepub fn into_first_child(self) -> Result<Self, Self>
pub fn into_first_child(self) -> Result<Self, Self>
Returns the first child of this node.
Returns Ok(first_child)
if possible and Err(self)
otherwise
so the caller can recover the current position.
sourcepub fn last_child(&mut self) -> Option<NodeMut<'_, T>>
pub fn last_child(&mut self) -> Option<NodeMut<'_, T>>
Returns the last child of this node.
sourcepub fn into_last_child(self) -> Result<Self, Self>
pub fn into_last_child(self) -> Result<Self, Self>
Returns the last child of this node.
Returns Ok(last_child)
if possible and Err(self)
otherwise
so the caller can recover the current position.
sourcepub fn has_siblings(&self) -> bool
pub fn has_siblings(&self) -> bool
Returns true if this node has siblings.
sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Returns true if this node has children.
sourcepub fn append_subtree(&mut self, subtree: Tree<T>) -> NodeMut<'_, T>
pub fn append_subtree(&mut self, subtree: Tree<T>) -> NodeMut<'_, T>
Appends a subtree, return the root of the merged subtree.
sourcepub fn prepend_subtree(&mut self, subtree: Tree<T>) -> NodeMut<'_, T>
pub fn prepend_subtree(&mut self, subtree: Tree<T>) -> NodeMut<'_, T>
Prepends a subtree, return the root of the merged subtree.
sourcepub fn insert_before(&mut self, value: T) -> NodeMut<'_, T>
pub fn insert_before(&mut self, value: T) -> NodeMut<'_, T>
sourcepub fn insert_after(&mut self, value: T) -> NodeMut<'_, T>
pub fn insert_after(&mut self, value: T) -> NodeMut<'_, T>
sourcepub fn prepend_id(&mut self, new_child_id: NodeId) -> NodeMut<'_, T>
pub fn prepend_id(&mut self, new_child_id: NodeId) -> NodeMut<'_, T>
sourcepub fn insert_id_before(&mut self, new_sibling_id: NodeId) -> NodeMut<'_, T>
pub fn insert_id_before(&mut self, new_sibling_id: NodeId) -> NodeMut<'_, T>
Inserts a sibling before this node.
§Panics
- Panics if
new_sibling_id
is not valid. - Panics if this node is an orphan.
sourcepub fn insert_id_after(&mut self, new_sibling_id: NodeId) -> NodeMut<'_, T>
pub fn insert_id_after(&mut self, new_sibling_id: NodeId) -> NodeMut<'_, T>
Inserts a sibling after this node.
§Panics
- Panics if
new_sibling_id
is not valid. - Panics if this node is an orphan.
sourcepub fn reparent_from_id_append(&mut self, from_id: NodeId)
pub fn reparent_from_id_append(&mut self, from_id: NodeId)
Reparents the children of a node, appending them to this node.
§Panics
Panics if from_id
is not valid.
sourcepub fn reparent_from_id_prepend(&mut self, from_id: NodeId)
pub fn reparent_from_id_prepend(&mut self, from_id: NodeId)
Reparents the children of a node, prepending them to this node.
§Panics
Panics if from_id
is not valid.