NodeMethod

Trait NodeMethod 

Source
pub trait NodeMethod<T: AsRef<[u8]>> {
    // Required methods
    fn get_hash(&self) -> Hash;
    fn verify(&self) -> Result<(), (Hash, Hash)>;
}
Expand description

Trait for running methods on any abstract kind of node, such as hash verification or just getting the hash

Required Methods§

Source

fn get_hash(&self) -> Hash

Gets the blake3-based [Hash] for trait implementation, just call on any Node, Data or NodeType like so: item.get_hash(). Typically all this method will do is get the self.hash but this can be used to adapt a broader NodeType

Source

fn verify(&self) -> Result<(), (Hash, Hash)>

Verifies the node down through recursion, providing a high-level checking/verification method

If this fails, it will return the expected hash and the found hash where this hash failed at; this is formatted as (expected_hash, found_node)

Implementors§

Source§

impl<T: AsRef<[u8]>> NodeMethod<T> for NodeType<T>

Source§

impl<T: AsRef<[u8]>> NodeMethod<T> for Data<T>

Source§

impl<T: AsRef<[u8]>> NodeMethod<T> for Node<T>

Source§

impl<T: AsRef<[u8]>> NodeMethod<T> for Tree<T>