Node

Struct Node 

Source
pub struct Node<Payload, Edge, Children = Vec<usize>> { /* private fields */ }
Expand description

A node in the tree. A Node can carry a Payload, and annotate the branch to its parent with an Edge.

Implementations§

Source§

impl<Payload, Edge> Node<Payload, Edge>

Source

pub fn is_leaf(&self) -> bool

Return true if this node has no children.

Source

pub fn children(&self) -> &[usize]

Returns a slice of the NodeID of this node children.

Source

pub fn data(&self) -> &Payload

If this node has a Payload, returns a reference to it

Source

pub fn data_mut(&mut self) -> &mut Payload

If this node has a Payload, returns a mutable reference to it

Source

pub fn set_data(&mut self, e: Payload)

Set the [Payload] of this Node

Source

pub fn branch(&self) -> Option<&Edge>

Returns a reference to this node parent branch [Edge]

Source

pub fn set_branch(&mut self, e: Edge)

Set the [Edge] of this node parent branch

Source

pub fn unset_branch(&mut self)

Unset the [Edge] of this node parent branch

Auto Trait Implementations§

§

impl<Payload, Edge, Children> Freeze for Node<Payload, Edge, Children>
where Children: Freeze, Payload: Freeze, Edge: Freeze,

§

impl<Payload, Edge, Children> RefUnwindSafe for Node<Payload, Edge, Children>
where Children: RefUnwindSafe, Payload: RefUnwindSafe, Edge: RefUnwindSafe,

§

impl<Payload, Edge, Children> Send for Node<Payload, Edge, Children>
where Children: Send, Payload: Send, Edge: Send,

§

impl<Payload, Edge, Children> Sync for Node<Payload, Edge, Children>
where Children: Sync, Payload: Sync, Edge: Sync,

§

impl<Payload, Edge, Children> Unpin for Node<Payload, Edge, Children>
where Children: Unpin, Payload: Unpin, Edge: Unpin,

§

impl<Payload, Edge, Children> UnwindSafe for Node<Payload, Edge, Children>
where Children: UnwindSafe, Payload: UnwindSafe, Edge: UnwindSafe,

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.