[]Struct sc_network::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 to_vec(&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 AsRef<[u8]> for Multihash

impl Borrow<[u8]> for Multihash

impl Clone for Multihash

impl Debug for Multihash

impl Eq for Multihash

impl From<PeerId> for Multihash

impl Hash for Multihash

impl PartialEq<Multihash> for Multihash

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

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

impl StructuralEq for Multihash

impl StructuralPartialEq for Multihash

impl TryFrom<Multihash> for PeerId

type Error = Multihash

The type returned in the event of a conversion error.

impl TryFrom<Vec<u8>> for Multihash

type Error = DecodeOwnedError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

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

impl<T, U> AsByteSlice<T> for U where
    T: ToByteSlice,
    U: AsRef<[T]> + ?Sized

impl<U> AsSliceOf for U where
    U: AsRef<[u8]> + ?Sized

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

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

impl<T> CheckedConversion for T[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

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

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeHash for T where
    T: Hash
[src]

impl<T> MaybeHash for T where
    T: Hash

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Member for T where
    T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[src]

impl<T> ProtocolName for T where
    T: AsRef<[u8]>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,