pub struct Node<T> { /* private fields */ }
Expand description

The Dag node, aka vertex.

Implementations

Create a new DAG leaf node that contains the given value.

Example
use narwhal_dag::{ Node, NodeRef };

let node = Node::new_leaf(1, false);

Create a new DAG inner node that contains the given value and points to the given parents.

Return the value payload of the node

Example
use narwhal_dag::Node;

let node = Node::new_leaf(1, false);
assert_eq!(*node.value(), 1);

Is the node parent-less?

Examples
use narwhal_dag::Node;

let node = Node::new_leaf(1, false);
assert_eq!(node.is_leaf(), true);

Is the node compressible?

Examples
use narwhal_dag::Node;

let node = Node::new_leaf(1, true);
assert_eq!(node.is_compressible(), true);

Make the node compressible. Returns true if the node was made compressible, false if it already was.

Beware: this operation is irreversible.

Examples
use narwhal_dag::Node;

let node = Node::new_leaf(1, false);
assert_eq!(node.make_compressible(), true);
let node2 = Node::new_leaf(2, true);
assert_eq!(node.make_compressible(), false);

Compress the path from this node to the next incompressible layer of the DAG. Returns the parents of the node.

After path compression, one of these three conditions holds:

  • This node is a leaf node;
  • This node has only incompressible parents, and keeps them;
  • This node has compressible parents, and after path compression, they are replaced by their closest incompressible ancestors.

Trait Implementations

Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.