pub struct Node {
pub weight: u32,
pub depth: u8,
pub syms: u32,
pub node_data: NodeData,
}Expand description
Huffman codes are built from weights derived from a tree structure of these nodes.
Fields§
§weight: u32The weight of the node is based on the frequency of the symbols under this node
depth: u8The depth of the node in the tree
syms: u32§node_data: NodeDataThe data associated with this node (either a leaf or a node that (eventually) has leaves)
Implementations§
Trait Implementations§
Source§impl Ord for Node
impl Ord for Node
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Sort Nodes by decreasing weight and decreasing symbol value
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Node
impl PartialOrd for Node
impl Eq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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