pub struct Multihash { /* private fields */ }
Expand description
Represents a valid multihash.
Implementations§
Source§impl Multihash
impl Multihash
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Result<Multihash, DecodeOwnedError>
pub fn from_bytes(bytes: Vec<u8>) -> Result<Multihash, DecodeOwnedError>
Verifies whether bytes
contains a valid multihash, and if so returns a Multihash
.
Sourcepub fn random(hash: Hash) -> Multihash
pub fn random(hash: Hash) -> Multihash
Generates a random Multihash
from a cryptographically secure PRNG.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Returns the bytes representation of the multihash.
Sourcepub fn as_ref(&self) -> MultihashRef<'_>
pub fn as_ref(&self) -> MultihashRef<'_>
Builds a MultihashRef
corresponding to this Multihash
.
Trait Implementations§
Source§impl<'a> PartialEq<Multihash> for MultihashRef<'a>
impl<'a> PartialEq<Multihash> for MultihashRef<'a>
Source§impl<'a> PartialEq<MultihashRef<'a>> for Multihash
impl<'a> PartialEq<MultihashRef<'a>> for Multihash
impl Eq for Multihash
impl StructuralPartialEq for Multihash
Auto Trait Implementations§
impl !Freeze for Multihash
impl RefUnwindSafe for Multihash
impl Send for Multihash
impl Sync for Multihash
impl Unpin for Multihash
impl UnwindSafe for Multihash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more