pub struct ForestNodeMut<'a, T> { /* private fields */ }
Implementations§
Source§impl<'a, T> ForestNodeMut<'a, T>
impl<'a, T> ForestNodeMut<'a, T>
Sourcepub fn borrow_mut<'b>(
&'b mut self,
target: &'b ForestNodeRc<T>,
) -> ForestNodeMut<'b, T>
pub fn borrow_mut<'b>( &'b mut self, target: &'b ForestNodeRc<T>, ) -> ForestNodeMut<'b, T>
Borrow another node in the same forest.
Sourcepub fn resolve_token<'b>(
&'b mut self,
target: &ForestToken,
) -> Option<ForestNodeRc<T>>
pub fn resolve_token<'b>( &'b mut self, target: &ForestToken, ) -> Option<ForestNodeRc<T>>
Resolve a token to a ForestNodeRc
.
The node which the token pointed to must be in the same forest and still has a valid ForestNodeRc
.
Sourcepub fn borrow_mut_token<'b>(
&'b mut self,
target: &ForestToken,
) -> Option<ForestNodeMut<'b, T>>
pub fn borrow_mut_token<'b>( &'b mut self, target: &ForestToken, ) -> Option<ForestNodeMut<'b, T>>
Borrow another node with a token.
The node which the token pointed to must be in the same forest and still has a valid ForestNodeRc
.
Sourcepub fn as_ref<'b>(&'b self) -> ForestNode<'b, T>
pub fn as_ref<'b>(&'b self) -> ForestNode<'b, T>
Get an immutable reference.
Sourcepub fn map<'b, U>(
&'b mut self,
f: impl FnOnce(&'b mut T) -> &'b mut U,
) -> ForestValueMut<'b, U>
pub fn map<'b, U>( &'b mut self, f: impl FnOnce(&'b mut T) -> &'b mut U, ) -> ForestValueMut<'b, U>
Make a wrapped component the contained value, keeping the borrowing status.
Sourcepub fn rc(&self) -> ForestNodeRc<T>
pub fn rc(&self) -> ForestNodeRc<T>
Get the ForestNodeRc
of current node.
Sourcepub fn parent_rc(&self) -> Option<ForestNodeRc<T>>
pub fn parent_rc(&self) -> Option<ForestNodeRc<T>>
Get the parent node.
Sourcepub fn first_child_rc(&mut self) -> Option<ForestNodeRc<T>>
pub fn first_child_rc(&mut self) -> Option<ForestNodeRc<T>>
Get the first child node.
Sourcepub fn first_child_mut<'b>(&'b mut self) -> Option<ForestNodeMut<'b, T>>
pub fn first_child_mut<'b>(&'b mut self) -> Option<ForestNodeMut<'b, T>>
Get the first child node.
Sourcepub fn last_child_rc(&self) -> Option<ForestNodeRc<T>>
pub fn last_child_rc(&self) -> Option<ForestNodeRc<T>>
Get the last child node.
Sourcepub fn prev_sibling_rc(&self) -> Option<ForestNodeRc<T>>
pub fn prev_sibling_rc(&self) -> Option<ForestNodeRc<T>>
Get the previous sibling node.
Sourcepub fn next_sibling_rc(&mut self) -> Option<ForestNodeRc<T>>
pub fn next_sibling_rc(&mut self) -> Option<ForestNodeRc<T>>
Get the next sibling node.
Sourcepub fn next_sibling_mut<'b>(&'b mut self) -> Option<ForestNodeMut<'b, T>>
pub fn next_sibling_mut<'b>(&'b mut self) -> Option<ForestNodeMut<'b, T>>
Get the next sibling node.
Sourcepub fn new_tree(&mut self, content: T) -> ForestNodeRc<T>
pub fn new_tree(&mut self, content: T) -> ForestNodeRc<T>
Create a new tree in the same forest.
Sourcepub fn append(&mut self, target: &ForestNodeRc<T>)
pub fn append(&mut self, target: &ForestNodeRc<T>)
Append a tree as the last child node.
Sourcepub fn insert(&mut self, target: &ForestNodeRc<T>)
pub fn insert(&mut self, target: &ForestNodeRc<T>)
Insert a tree as the previous sibling node of the current node.
Sourcepub fn detach(self) -> ForestNodeRc<T>
pub fn detach(self) -> ForestNodeRc<T>
Remove the node from its parent node.