Skip to main content

MultihashDigest

Trait MultihashDigest 

Source
pub trait MultihashDigest<const S: usize>:
    TryFrom<u64, Error = UnsupportedCode>
    + Into<u64>
    + Send
    + Sync
    + Unpin
    + Copy
    + Eq
    + Debug
    + 'static {
    // Required methods
    fn digest(&self, input: &[u8]) -> Multihash<S>;
    fn wrap(&self, digest: &[u8]) -> Result<Multihash<S>, Error>;
}
Expand description

Trait that implements hashing.

Typically, you won’t implement this yourself but use the MultihashDigest custom-derive.

Required Methods§

Source

fn digest(&self, input: &[u8]) -> Multihash<S>

Calculate the hash of some input data.

Source

fn wrap(&self, digest: &[u8]) -> Result<Multihash<S>, Error>

Create a multihash from an existing multihash digest.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§