Struct mhash::MultiHash
[−]
[src]
pub struct MultiHash { /* fields omitted */ }
A decoded multihash.
Methods
impl MultiHash
[src]
fn new(variant: MultiHashVariant, digest: &[u8]) -> Result<MultiHash>
Create a new multihash with the specified variant and digest. Validates the length of the digest is consistent with the multihash variant.
fn new_with_code(code: usize, digest: &[u8]) -> Result<MultiHash>
Create a new multihash with the specified code and digest, validates that the code is known or an application specific variant, and that the length is consistent with the multihash variant the code refers to.
fn len(&self) -> usize
The length of this multihash's digest.
fn variant(&self) -> MultiHashVariant
This multihash's variant.
fn code(&self) -> usize
The code specifying this multihash variant.
fn name(&self) -> &'static str
The string representation of this multihash type.
fn digest(&self) -> &[u8]
A reference to the bytes making up the digest of this multihash.
impl MultiHash
[src]
impl MultiHash
[src]
fn to_bytes(&self) -> Vec<u8>
Create a Vec<u8>
with the binary encoding of this multihash.
fn output_len(&self) -> usize
The length this multihash will use when serialized to a byte array/stream.
Trait Implementations
impl Eq for MultiHash
[src]
impl PartialEq for MultiHash
[src]
fn eq(&self, __arg_0: &MultiHash) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MultiHash) -> bool
This method tests for !=
.
impl Clone for MultiHash
[src]
fn clone(&self) -> MultiHash
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Hash for MultiHash
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more