pub struct Node<T> { /* private fields */ }Implementations§
Source§impl<T> Node<T>
impl<T> Node<T>
Sourcepub fn new(
key: T,
depth: u16,
index_len: u16,
index: Option<T>,
left_child: Option<T>,
right_child: Option<T>,
) -> Node<T>
pub fn new( key: T, depth: u16, index_len: u16, index: Option<T>, left_child: Option<T>, right_child: Option<T>, ) -> Node<T>
Creates a new node object with the given parameters.
§Arguments
key- Key value of the node.depth- Index depth: first useful bit of its index.index_len- Number of useful index bits. This value is not used for leaves.index- Index it is representing.left_child- For nodes it represents the key of its left child and for leaves its own key.right_child- For nodes it represents the key of its right child and for leaves its own key.
Sourcepub fn is_root(&self) -> bool
pub fn is_root(&self) -> bool
Returns a boolean value that tells if it represents the root. For a node to be a root it must:
- Have
depth== 0 && - Have
index_len== 0 && - Not be a leaf
Sourcepub fn is_intermediate(&self) -> bool
pub fn is_intermediate(&self) -> bool
Returns a boolean value that tells if it represents a intermediate node. For a node to be intermediate it must:
- Not be a leaf.
- Not be a root.
Sourcepub fn get_key(&self) -> &T
pub fn get_key(&self) -> &T
Returns a reference to the key representing the node calculated by merging its childs.
Sourcepub fn get_index_length(&self) -> &u16
pub fn get_index_length(&self) -> &u16
Returns the first useful bits of the node index.
Sourcepub fn set_index_length(&mut self, index_len: u16)
pub fn set_index_length(&mut self, index_len: u16)
Sets the amount of useful bits of the node index.
Sourcepub fn get_left_child(&self) -> &Option<T>
pub fn get_left_child(&self) -> &Option<T>
Returns the key of the left child. It will be None if the node represents a leaf.
Sourcepub fn get_right_child(&self) -> &Option<T>
pub fn get_right_child(&self) -> &Option<T>
Returns the key of the right child. It will be None if the node represents a leaf.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Node<T>where
T: Freeze,
impl<T> RefUnwindSafe for Node<T>where
T: RefUnwindSafe,
impl<T> Send for Node<T>where
T: Send,
impl<T> Sync for Node<T>where
T: Sync,
impl<T> Unpin for Node<T>where
T: Unpin,
impl<T> UnwindSafe for Node<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more