Type Alias multihash::MultihashGeneric
source · pub type MultihashGeneric<const N: usize> = Multihash<N>;
👎Deprecated since 0.18.0: Use `multihash::Multihash instead.
Expand description
Deprecated type-alias for the Multihash
type.
Aliased Type§
struct MultihashGeneric<const N: usize> { /* private fields */ }
Implementations
source§impl<const S: usize> Multihash<S>
impl<const S: usize> Multihash<S>
sourcepub const fn wrap(code: u64, input_digest: &[u8]) -> Result<Self, Error>
pub const fn wrap(code: u64, input_digest: &[u8]) -> Result<Self, Error>
Wraps the digest in a multihash.
sourcepub fn read<R: Read>(r: R) -> Result<Self, Error>where
Self: Sized,
pub fn read<R: Read>(r: R) -> Result<Self, Error>where
Self: Sized,
Reads a multihash from a byte stream.
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Parses a multihash from a bytes.
You need to make sure the passed in bytes have the correct length. The digest length
needs to match the size
value of the multihash.
sourcepub fn write<W: Write>(&self, w: W) -> Result<usize, Error>
pub fn write<W: Write>(&self, w: W) -> Result<usize, Error>
Writes a multihash to a byte stream, returning the written size.
sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the length in bytes needed to encode this multihash into bytes.
sourcepub fn truncate(&self, size: u8) -> Self
pub fn truncate(&self, size: u8) -> Self
Truncates the multihash to the given size. It’s up to the caller to ensure that the new size is secure (cryptographically) to use.
If the new size is larger than the current size, this method does nothing.
Trait Implementations
source§impl<const S: usize> Ord for Multihash<S>
impl<const S: usize> Ord for Multihash<S>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<const A: usize, const B: usize> PartialEq<Multihash<B>> for Multihash<A>
impl<const A: usize, const B: usize> PartialEq<Multihash<B>> for Multihash<A>
source§impl<const S: usize> PartialOrd for Multihash<S>
impl<const S: usize> PartialOrd for Multihash<S>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more