Trait Digest

Source
pub trait Digest<S: Size>:
    AsRef<[u8]>
    + AsMut<[u8]>
    + From<GenericArray<u8, S>>
    + Into<GenericArray<u8, S>>
    + Clone
    + Hash
    + Debug
    + Default
    + Eq
    + Send
    + Sync
    + 'static {
    // Provided methods
    fn size(&self) -> u8 { ... }
    fn wrap(digest: &[u8]) -> Result<Self, Error> { ... }
    fn from_reader<R>(r: R) -> Result<Self, Error>
       where R: Read { ... }
}
Expand description

Stack allocated digest trait.

Provided Methods§

Source

fn size(&self) -> u8

Size of the digest.

Source

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

Wraps the digest bytes.

Source

fn from_reader<R>(r: R) -> Result<Self, Error>
where R: Read,

Reads a multihash digest from a byte stream that contains the digest prefixed with the size.

The byte stream must not contain the code as prefix.

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§

Source§

impl<S: Size> Digest<S> for Blake2bDigest<S>

Source§

impl<S: Size> Digest<S> for Blake2sDigest<S>

Source§

impl<S: Size> Digest<S> for Blake3Digest<S>

Source§

impl<S: Size> Digest<S> for IdentityDigest<S>

Source§

impl<S: Size> Digest<S> for KeccakDigest<S>

Source§

impl<S: Size> Digest<S> for Sha1Digest<S>

Source§

impl<S: Size> Digest<S> for Sha2Digest<S>

Source§

impl<S: Size> Digest<S> for Sha3Digest<S>

Source§

impl<S: Size> Digest<S> for StrobeDigest<S>

Source§

impl<S: Size> Digest<S> for UnknownDigest<S>