pub trait HashType: Copy + Clone + Debug + Clone + Hash + PartialEq + Eq + PartialOrd + Ord {
    // Required methods
    fn get_prefix(self) -> &'static [u8] ;
    fn try_from_prefix(prefix: &[u8]) -> HoloHashResult<Self>;
    fn hash_name(self) -> &'static str;
}
Expand description

Every HoloHash is generic over HashType. Additionally, every HashableContent has an associated HashType. The HashType is the glue that binds together HashableContent with its hash.

Required Methods§

source

fn get_prefix(self) -> &'static [u8]

Get the 3-byte prefix for the underlying primitive hash type

source

fn try_from_prefix(prefix: &[u8]) -> HoloHashResult<Self>

Given a 3-byte prefix, return the corresponding HashType, or error if mismatched. Trivial for PrimitiveHashType, but useful for composite types

source

fn hash_name(self) -> &'static str

Get a Display-worthy name for this hash type

Object Safety§

This trait is not object safe.

Implementors§