pub trait Node<'a> {
// Required methods
fn cmp(&'a self, other: &'a Self) -> Ordering;
fn get_raw(&'a self) -> &RawNode<'a, Self>;
}
Expand description
Any struct can be used as the fib heap element simply by embedding a RawNode
in it (or wrapping it in a struct containing a raw node) and implementing this trait.
Required Methods§
sourcefn cmp(&'a self, other: &'a Self) -> Ordering
fn cmp(&'a self, other: &'a Self) -> Ordering
Comparison function for nodes, can just wrap Ord impl if present
sourcefn get_raw(&'a self) -> &RawNode<'a, Self>
fn get_raw(&'a self) -> &RawNode<'a, Self>
Get a reference to the embedded raw node. This is used internally to traverse and bookkeep the heap.
Accessing this is not thread safe as-is. Implementors can place the raw node under a lock,
but it’s better to lock the entire FibHeap
to avoid race conditions.
Object Safety§
This trait is not object safe.