[][src]Trait multihash::MultihashDigest

pub trait MultihashDigest<C: MultihashCode>: Clone + Debug + Eq + Send + Sync + 'static {
    fn code(&self) -> C;
fn digest(&self) -> &[u8];
fn read<R: Read>(r: R) -> Result<Self, Error>
    where
        Self: Sized
; fn size(&self) -> u8 { ... }
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
    where
        Self: Sized
, { ... }
fn write<W: Write>(&self, w: W) -> Result<(), Error> { ... }
fn to_bytes(&self) -> Vec<u8> { ... } }

Trait for a multihash digest.

Required methods

fn code(&self) -> C

Returns the code of the multihash.

fn digest(&self) -> &[u8]

Returns the digest.

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

Reads a multihash from a byte stream.

Loading content...

Provided methods

fn size(&self) -> u8

Returns the size of the digest.

fn from_bytes(bytes: &[u8]) -> Result<Self, Error> where
    Self: Sized

Parses a multihash from a bytes.

fn write<W: Write>(&self, w: W) -> Result<(), Error>

Writes a multihash to a byte stream.

fn to_bytes(&self) -> Vec<u8>

Returns the bytes of a multihash.

Loading content...

Implementors

impl MultihashDigest<Code> for Multihash[src]

Loading content...