Struct NodeMut

Source
pub struct NodeMut<'a, 'b, T> { /* private fields */ }
Expand description

A mutable reference to a node in the tree.

Implementations§

Source§

impl<'a, 'b, T> NodeMut<'a, 'b, T>

Source

pub fn get(&self) -> &T

Returns a reference to the user data stored in this node.

Source

pub fn get_mut(&mut self) -> &mut T

Returns a mutable reference to the user data stored in this node.

Trait Implementations§

Source§

impl<'a, T> AsRef<Node<'a, T>> for NodeMut<'a, '_, T>

Source§

fn as_ref(&self) -> &Node<'a, T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T> Debug for NodeMut<'a, '_, T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T> HasChildren<'a, T> for NodeMut<'a, '_, T>

Source§

fn children(&self) -> &[Node<'a, T>]

Returns a reference to the child nodes.
Source§

fn is_empty(&self) -> bool

Returns true if this node has no children, false otherwise.
Source§

fn len(&self) -> usize

Returns the number of child nodes.
Source§

fn iter(&self) -> Iter<'_, Node<'a, T>>

Returns an iterator over references to the child nodes.
Source§

fn at(&self, index: usize) -> &Node<'a, T>

Returns a reference to the child node at the given index.
Source§

impl<'a, T> HasChildrenMut<'a, T> for NodeMut<'a, '_, T>

Source§

fn children_mut(&mut self) -> NodeChildrenMut<'a, '_, T>

Returns a mutable reference to the child nodes.
Source§

fn set_children<I>(&mut self, iterable: I)
where I: IntoIterator<Item = T>,

Sets the child nodes using the provided iterable. Read more
Source§

fn set_children_subtree<I, F, U>(&mut self, iterable: I, builder: F)
where I: IntoIterator<Item = (T, U)>, F: FnMut(NodeMut<'a, '_, T>, U),

Sets the child nodes using the provided iterable, allowing recursive construction of a subtree. Read more
Source§

fn adopt_grandchildren_at(&mut self, index: usize)

Adopts the children of the child node at the given index as the children here. Read more
Source§

fn move_children_to_root(&mut self)

Moves the child nodes from here to become the roots of the tree. Read more
Source§

fn iter_mut(&mut self) -> NodeIterMut<'a, '_, T>

Returns an iterator over mutable references to the child nodes.
Source§

fn at_mut(&mut self, index: usize) -> NodeMut<'a, '_, T>

Returns a mutable reference to the child node at the given index.

Auto Trait Implementations§

§

impl<'a, 'b, T> Freeze for NodeMut<'a, 'b, T>

§

impl<'a, 'b, T> !RefUnwindSafe for NodeMut<'a, 'b, T>

§

impl<'a, 'b, T> !Send for NodeMut<'a, 'b, T>

§

impl<'a, 'b, T> !Sync for NodeMut<'a, 'b, T>

§

impl<'a, 'b, T> Unpin for NodeMut<'a, 'b, T>

§

impl<'a, 'b, T> !UnwindSafe for NodeMut<'a, 'b, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.