multihash_derive

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", so this trait is not object safe.

Implementors§