Struct ColorNode

Source
pub struct ColorNode<T> {
    pub value: T,
    pub ptr: usize,
    pub parent: Option<usize>,
    pub lchild: Option<usize>,
    pub rchild: Option<usize>,
    pub color: Color,
    /* private fields */
}

Fields§

§value: T§ptr: usize§parent: Option<usize>§lchild: Option<usize>§rchild: Option<usize>§color: Color

Trait Implementations§

Source§

impl<T> ColoredNode<T> for ColorNode<T>
where T: Debug + PartialOrd,

Source§

fn new(val: T, selfptr: usize, data: Rc<RefCell<Vec<ColorNode<T>>>>) -> Self

Source§

fn is_red(&self) -> bool

Source§

fn is_child_black(&self, side: Side) -> bool

Source§

fn is_parent_black(&self) -> bool

Source§

fn is_sibling_black(&self) -> bool

Source§

impl<T: Debug> Debug for ColorNode<T>

Source§

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

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

impl<T: Debug + PartialOrd> Node<T> for ColorNode<T>

Source§

fn get(&self, ptr: usize) -> &ColorNode<T>

In order to return a reference to a value of a vector contained within a refcell, a raw pointer is used. The unsafe code could be avoided by replacing each call to self.get(n) with &self.data.borrow()[n] and each call to self.get_mut(n) with &mut self.data.borrow()[n]

Source§

fn to_self_string(&self) -> String

Source§

fn to_self_string_display(&self) -> (String, usize)

Source§

fn is(&self, val: &T) -> bool

Source§

fn greater(&self, val: &T) -> bool

Source§

fn lesser(&self, val: &T) -> bool

Source§

fn get_value(&self) -> &T

Source§

fn get_mut(&self, ptr: usize) -> &mut ColorNode<T>

Source§

fn get_child(&self, side: Side) -> Option<usize>

Source§

fn set_child(&mut self, child: usize, side: Side)

Source§

fn set_child_opt(&mut self, c: Option<usize>, side: Side)

Source§

fn set_parent(&mut self, p: Option<usize>)

Source§

fn get_parent(&self) -> Option<usize>

Source§

fn location(&self) -> usize

Source§

fn to_string(&self) -> String

Source§

fn to_pretty_string(&self, indent: usize) -> String

Source§

fn get_height(&self) -> usize

Source§

fn get_depth(&self) -> usize

Source§

fn get_size(&self) -> usize

Source§

fn get_leaf_count(&self) -> usize

Source§

fn find_min(&self) -> usize

Source§

fn side(&self) -> Side

Source§

fn get_sibling(&self) -> Option<usize>

Source§

fn get_uncle(&self) -> Option<usize>

Source§

fn is_child(&self, side: Side) -> bool

Auto Trait Implementations§

§

impl<T> Freeze for ColorNode<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for ColorNode<T>

§

impl<T> !Send for ColorNode<T>

§

impl<T> !Sync for ColorNode<T>

§

impl<T> Unpin for ColorNode<T>
where T: Unpin,

§

impl<T> !UnwindSafe for ColorNode<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.