Trait Node

Source
pub trait Node {
    type Kind: PartialEq;
    type Weight: Default + Copy + Ord + Add<Output = Self::Weight>;

    // Required methods
    fn kind(&self) -> Self::Kind;
    fn weight(&self) -> Self::Weight;
}
Expand description

An abstraction for a generic tree node.

Required Associated Types§

Source

type Kind: PartialEq

The type of this Node’s kind.

Only Nodes of the equal kind can replace each other.

Source

type Weight: Default + Copy + Ord + Add<Output = Self::Weight>

The type of this Node’s weight.

The default value of this type is assumed to be the additive identity (i.e. zero).

Required Methods§

Source

fn kind(&self) -> Self::Kind

Returns this Node’s kind.

Source

fn weight(&self) -> Self::Weight

Returns the cost of inserting or deleting this Node.

A Node’s weight should be independent of the weight of its children.

Implementors§