bitstring_trees::tree

Struct Node

source
pub struct Node<TP: TreeProperties> { /* private fields */ }
Expand description

Node in tree

Implementations§

source§

impl<TP: TreeProperties> Node<TP>

source

pub fn get_key(&self) -> &TP::Key

Get key of node

source

pub fn get_value(&self) -> &TP::Value

Get value of node

source

pub fn get_value_mut(&mut self) -> &mut TP::Value

Get mutable value of node

source

pub fn is_leaf(&self) -> bool

Whether node is a leaf

source

pub fn get_leaf_value(&self) -> Option<&TP::LeafValue>

Return reference to leaf value if node is a leaf

source

pub fn get_leaf_value_mut(&mut self) -> Option<&mut TP::LeafValue>

Return mutable reference to leaf value if node is a leaf

source

pub fn set_leaf_value(&mut self, value: TP::LeafValue) -> &mut TP::LeafValue

Make node a leaf node (i.e. drop potential child nodes) and set leaf value

source

pub fn get_or_make_leaf_value_with<F>(&mut self, f: F) -> &mut TP::LeafValue
where F: FnOnce() -> TP::LeafValue,

Return mutable reference to leaf value

If node isn’t a leaf, make it one and initialize it with given constructor

source

pub fn get_children(&self) -> Option<(&Self, &Self)>

Return reference to (left, right) child nodes unless node is a leaf

source

pub fn get_children_mut(&mut self) -> Option<(&mut Self, &mut Self)>

Return mutable reference to (left, right) child nodes unless node is a leaf

source

pub fn get_left(&self) -> Option<&Self>

Return reference to left child node unless node is a leaf

source

pub fn get_left_mut(&mut self) -> Option<&mut Self>

Return mutable reference to left child node unless node is a leaf

source

pub fn get_right(&self) -> Option<&Self>

Return reference to right child node unless node is a leaf

source

pub fn get_right_mut(&mut self) -> Option<&mut Self>

Return mutable reference to right child node unless node is a leaf

source

pub fn get_child(&self, side_bit: bool) -> Option<&Node<TP>>

Return reference to requested child node unless node is a leaf

false returns left and true returns right node.

source

pub fn get_child_mut(&mut self, side_bit: bool) -> Option<&mut Node<TP>>

Return mutable reference to requested child node unless node is a leaf

false returns left and true returns right node.

Trait Implementations§

source§

impl<TP> Clone for Node<TP>
where TP: TreeProperties, TP::Value: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.6.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<TP> Debug for Node<TP>
where TP: TreeProperties, TP::Key: Debug, TP::Value: Debug, TP::LeafValue: Debug,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<TP> Freeze for Node<TP>

§

impl<TP> RefUnwindSafe for Node<TP>

§

impl<TP> Send for Node<TP>

§

impl<TP> Sync for Node<TP>

§

impl<TP> Unpin for Node<TP>

§

impl<TP> UnwindSafe for Node<TP>

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.