[−]Struct libp2p::core::multiaddr::multihash::Multihash
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
fn eq(&self, other: &MultihashRef<'a>) -> bool
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=
.
impl<'a> PartialEq<Multihash> for MultihashRef<'a>
fn eq(&self, other: &Multihash) -> bool
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=
.
impl PartialEq<Multihash> for Multihash
impl Clone for Multihash
fn clone(&self) -> 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<__H>(&self, state: &mut __H) where
__H: Hasher,
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl AsRef<Multihash> for PeerId
[src]
impl PartialEq<Multihash> for PeerId
[src]
fn eq(&self, other: &Multihash) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=
.
impl PartialEq<PeerId> for Multihash
[src]
fn eq(&self, other: &PeerId) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=
.
impl Into<Multihash> for PeerId
[src]
impl KBucketsPeerId<Multihash> for PeerId
[src]
fn distance_with(&self, other: &Multihash) -> u32
[src]
fn max_distance() -> usize
[src]
impl KBucketsPeerId<Multihash> for Multihash
[src]
fn distance_with(&self, other: &Multihash) -> u32
[src]
fn max_distance() -> usize
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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,
T: Any,