Enum cmprsd::util::binary_tree::Tree
source · pub enum Tree<T: Ord> {
Node {
content: T,
left: Box<Tree<T>>,
right: Box<Tree<T>>,
},
Leaf(T),
}Variants§
Implementations§
source§impl<T: Ord + Copy> Tree<T>
impl<T: Ord + Copy> Tree<T>
pub fn len(&self) -> usize
pub fn height(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn to_breadth_first_search(&self) -> Vec<T>
pub fn leaf_paths(&self) -> Vec<(Vec<Direction>, T)>
pub fn build_internal_node(content: T, left: Tree<T>, right: Tree<T>) -> Tree<T>
pub fn get_value(&self) -> &T
pub fn get_all_values(&self) -> Vec<T>
pub fn get_value_from_directions( &self, direction: Direction ) -> Option<&Tree<T>>
Trait Implementations§
source§impl<T: Ord + Copy> Ord for Tree<T>
impl<T: Ord + Copy> Ord for Tree<T>
source§impl<T: PartialEq + Ord> PartialEq for Tree<T>
impl<T: PartialEq + Ord> PartialEq for Tree<T>
source§impl<T: Ord + Copy> PartialOrd for Tree<T>
impl<T: Ord + Copy> PartialOrd for Tree<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: Eq + Ord> Eq for Tree<T>
impl<T: Ord> StructuralPartialEq for Tree<T>
Auto Trait Implementations§
impl<T> Freeze for Tree<T>
impl<T> RefUnwindSafe for Tree<T>
impl<T> Send for Tree<T>
impl<T> Sync for Tree<T>
impl<T> Unpin for Tree<T>
impl<T> UnwindSafe for Tree<T>
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