[]Struct libp2p::core::multiaddr::multihash::Multihash

pub struct Multihash { /* fields omitted */ }

Represents a valid multihash.

Methods

impl Multihash

pub fn from_bytes(bytes: Vec<u8>) -> Result<Multihash, DecodeOwnedError>

Verifies whether bytes contains a valid multihash, and if so returns a Multihash.

pub fn random(hash: Hash) -> Multihash

Generates a random Multihash from a cryptographically secure PRNG.

pub fn into_bytes(self) -> Vec<u8>

Returns the bytes representation of the multihash.

pub fn as_bytes(&self) -> &[u8]

Returns the bytes representation of this multihash.

pub fn as_ref(&self) -> MultihashRef

Builds a MultihashRef corresponding to this Multihash.

pub fn algorithm(&self) -> Hash

Returns which hashing algorithm is used in this multihash.

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

Returns the hashed data.

Trait Implementations

impl Debug for Multihash

impl Eq for Multihash

impl<'a> PartialEq<MultihashRef<'a>> for Multihash

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<'a> PartialEq<Multihash> for MultihashRef<'a>

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl PartialEq<Multihash> for Multihash

impl Clone for Multihash

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Hash for Multihash

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl AsRef<Multihash> for PeerId[src]

impl PartialEq<Multihash> for PeerId[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl PartialEq<PeerId> for Multihash[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Into<Multihash> for PeerId[src]

impl KBucketsPeerId<Multihash> for PeerId[src]

impl KBucketsPeerId<Multihash> for Multihash[src]

Auto Trait Implementations

impl Send for Multihash

impl Sync for Multihash

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.