Struct indextreemap::stc::Node

source ·
pub struct Node<K, V> {
    pub items: [Option<Box<Item<K, V>>>; 6],
    pub children: [Option<Box<Node<K, V>>>; 2],
    pub children_size: [usize; 2],
    pub child_difference: u8,
    pub height: u8,
}

Fields§

§items: [Option<Box<Item<K, V>>>; 6]§children: [Option<Box<Node<K, V>>>; 2]§children_size: [usize; 2]§child_difference: u8§height: u8

Implementations§

source§

impl<K: Key, V: Value> Node<K, V>

The balancing funcitons of the tree

source

pub fn is_balanced(&mut self) -> bool

source

pub fn balance(&mut self)

source

pub fn diff_balance(&mut self)

source

pub fn has_full_child(&self, index: (usize, usize)) -> (bool, bool)

source

pub fn single_rotation(&mut self, side: Side)

source

pub fn child_to_parent(&mut self, index: (usize, usize))

source

pub fn subchild_to_parent(&mut self, index: (usize, usize))

source

pub fn update_child_difference(&mut self)

source

pub fn height_balance(&mut self)

source

pub fn is_height_balanced(&mut self) -> bool

source

pub fn update_height(&mut self)

source

pub fn update_height_difference(&mut self) -> (u8, Ordering)

source

pub fn double_rotation(&mut self, side: Side)

source§

impl<K: Key, V: Value> Node<K, V>

source

pub fn get_item(&self, key: &K) -> Option<&Item<K, V>>

source

pub fn get_item_from_index(&self, id: usize) -> Option<&Item<K, V>>

source§

impl<K: Key, V: Value> Node<K, V>

source

pub fn insert(&mut self, key: K, value: Option<V>) -> bool

source

pub fn insert_with_overflow( &mut self, index: usize, key: K, value: Option<V> ) -> bool

source

pub fn insert_item(&mut self, index: usize, key: K, value: Option<V>)

source§

impl<K: Key, V: Value> Node<K, V>

source

pub fn remove(&mut self, key: &K) -> Option<Item<K, V>>

source

pub fn remove_index(&mut self, id: usize) -> Option<Item<K, V>>

source

pub fn replace_item(&mut self)

source

pub fn take_largest_item(&mut self) -> Option<Box<Item<K, V>>>

source

pub fn take_smallest_item(&mut self) -> Option<Box<Item<K, V>>>

source

pub fn is_empty(&self) -> bool

source

pub fn bias_right(&mut self)

source

pub fn bias_left(&mut self)

source§

impl<K: Key, V: Value> Node<K, V>

source

pub fn take_items(&mut self) -> [Option<Box<Item<K, V>>>; 6]

source

pub fn take_child(&mut self, index: usize) -> Option<Box<Node<K, V>>>

source

pub fn take_child_size(&mut self, index: usize) -> usize

source§

impl<K: Key, V: Value> Node<K, V>

source

pub fn new() -> Box<Node<K, V>>

source

pub fn is_full(&self) -> bool

Trait Implementations§

source§

impl<K: Clone, V: Clone> Clone for Node<K, V>

source§

fn clone(&self) -> Node<K, V>

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

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

Performs copy-assignment from source. Read more
source§

impl<K: Debug, V: Debug> Debug for Node<K, V>

source§

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

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

impl<K: Default, V: Default> Default for Node<K, V>

source§

fn default() -> Node<K, V>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<K, V> RefUnwindSafe for Node<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,

§

impl<K, V> Send for Node<K, V>where K: Send, V: Send,

§

impl<K, V> Sync for Node<K, V>where K: Sync, V: Sync,

§

impl<K, V> Unpin for Node<K, V>

§

impl<K, V> UnwindSafe for Node<K, V>where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.