pub struct BinaryNode<T: PartialOrd> {
pub value: T,
pub left: Option<Box<BinaryNode<T>>>,
pub right: Option<Box<BinaryNode<T>>>,
}Expand description
A node in a binary tree structure.
Each node contains a value of generic type T
and optional left/right child nodes wrapped in Box for heap allocation.
Fields§
§value: TThe value stored in this node.
left: Option<Box<BinaryNode<T>>>Left child node (less than parent value).
right: Option<Box<BinaryNode<T>>>Right child node (greater than parent value).
Implementations§
Source§impl<T: PartialOrd> BinaryNode<T>
impl<T: PartialOrd> BinaryNode<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BinaryNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for BinaryNode<T>where
T: RefUnwindSafe,
impl<T> Send for BinaryNode<T>where
T: Send,
impl<T> Sync for BinaryNode<T>where
T: Sync,
impl<T> Unpin for BinaryNode<T>where
T: Unpin,
impl<T> UnwindSafe for BinaryNode<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