[][src]Struct tentacle_secio::peer_id::PeerId

pub struct PeerId { /* fields omitted */ }

Identifier of a peer of the network

The data is a hash of the public key of the peer

Methods

impl PeerId[src]

pub fn from_public_key(public_key: &PublicKey) -> Self[src]

Builds a PeerId from a public key.

pub fn from_bytes(data: Vec<u8>) -> Result<Self, ()>[src]

If data is a valid PeerId, return PeerId, else return error

pub fn random() -> Self[src]

Return a random PeerId

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

Return raw bytes representation of this peer id

pub fn into_bytes(self) -> Vec<u8>[src]

Consume self, return raw bytes representation of this peer id

pub fn to_base58(&self) -> String[src]

Returns a base-58 encoded string of this PeerId.

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

Returns the raw bytes of the hash of this PeerId.

pub fn is_public_key(&self, public_key: &PublicKey) -> bool[src]

Checks whether the public key passed as parameter matches the public key of this PeerId.

Trait Implementations

impl Clone for PeerId[src]

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

Performs copy-assignment from source. Read more

impl From<PublicKey> for PeerId[src]

impl PartialOrd<PeerId> for PeerId[src]

impl PartialEq<PeerId> for PeerId[src]

impl Eq for PeerId[src]

impl Debug for PeerId[src]

impl Hash for PeerId[src]

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 FromStr for PeerId[src]

type Err = ()

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Sync for PeerId

impl Send for PeerId

impl Unpin for PeerId

impl RefUnwindSafe for PeerId

impl UnwindSafe for PeerId

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Erased for T

impl<T> Same<T> for T

type Output = T

Should always be Self