pub struct Node<T> { /* private fields */ }
Expand description
Node<T>
represents the single node in a tree.
Implementations§
Source§impl<T: ItemType> Node<T>
impl<T: ItemType> Node<T>
Sourcepub fn new(item: Option<T>, count: usize) -> Node<T>
pub fn new(item: Option<T>, count: usize) -> Node<T>
Create a new Node with the given item and count.
Sourcepub fn new_rc(item: Option<T>, count: usize) -> Rc<Node<T>>
pub fn new_rc(item: Option<T>, count: usize) -> Rc<Node<T>>
Create a new Rc
Sourcepub fn add_child(self: &Rc<Self>, child_node: Rc<Node<T>>)
pub fn add_child(self: &Rc<Self>, child_node: Rc<Node<T>>)
Add the given child Node as a child of this node.
pub fn remove_child(self: &Rc<Self>, child_node: Rc<Node<T>>)
Sourcepub fn search(&self, item: T) -> Option<Rc<Node<T>>>
pub fn search(&self, item: T) -> Option<Rc<Node<T>>>
Check whether this node contains a child node for the given item.
If so, that node’s reference is returned; otherwise, None
is returned.
Sourcepub fn increment(&self, incr_count: usize)
pub fn increment(&self, incr_count: usize)
Increment the count associated with this node’s item.
pub fn item(&self) -> Option<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Node<T>
impl<T> !RefUnwindSafe for Node<T>
impl<T> !Send for Node<T>
impl<T> !Sync for Node<T>
impl<T> Unpin for Node<T>where
T: Unpin,
impl<T> !UnwindSafe for Node<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