Struct diem_types::PeerId[][src]

pub struct PeerId(_);
Expand description

A struct that represents an account address.

Implementations

impl AccountAddress[src]

pub const fn new(address: [u8; 16]) -> AccountAddress[src]

pub const LENGTH: usize[src]

The number of bytes in an address.

pub const ZERO: AccountAddress[src]

Hex address: 0x0

pub fn random() -> AccountAddress[src]

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

pub fn to_vec(&self) -> Vec<u8, Global>[src]

pub fn to_u8(self) -> [u8; 16][src]

pub fn from_hex_literal(
    literal: &str
) -> Result<AccountAddress, AccountAddressParseError>
[src]

pub fn from_hex<T>(hex: T) -> Result<AccountAddress, AccountAddressParseError> where
    T: AsRef<[u8]>, 
[src]

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

pub fn from_bytes<T>(
    bytes: T
) -> Result<AccountAddress, AccountAddressParseError> where
    T: AsRef<[u8]>, 
[src]

Methods from Deref<Target = [u8; 16]>

pub fn as_slice(&self) -> &[T][src]

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

Returns a slice containing the entire array. Equivalent to &s[..].

pub fn each_ref(&self) -> [&T; N][src]

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

Borrows each element and returns an array of references with the same size as self.

Example

#![feature(array_methods)]

let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

#![feature(array_methods, array_map)]

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);

Trait Implementations

impl AsRef<[u8]> for AccountAddress[src]

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

Performs the conversion.

impl Clone for AccountAddress[src]

pub fn clone(&self) -> AccountAddress[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for AccountAddress[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Deref for AccountAddress[src]

type Target = [u8; 16]

The resulting type after dereferencing.

pub fn deref(&self) -> &<AccountAddress as Deref>::Target[src]

Dereferences the value.

impl<'de> Deserialize<'de> for AccountAddress[src]

pub fn deserialize<D>(
    deserializer: D
) -> Result<AccountAddress, <D as Deserializer<'de>>::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Display for AccountAddress[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<'_> From<&'_ AccountAddress> for [u8; 16][src]

pub fn from(addr: &AccountAddress) -> [u8; 16][src]

Performs the conversion.

impl From<[u8; 16]> for AccountAddress[src]

pub fn from(bytes: [u8; 16]) -> AccountAddress[src]

Performs the conversion.

impl From<AccountAddress> for [u8; 16][src]

pub fn from(addr: AccountAddress) -> [u8; 16][src]

Performs the conversion.

impl FromStr for AccountAddress[src]

type Err = AccountAddressParseError

The associated error which can be returned from parsing.

pub fn from_str(s: &str) -> Result<AccountAddress, AccountAddressParseError>[src]

Parses a string s to return a value of this type. Read more

impl Hash for AccountAddress[src]

pub fn hash<__H>(&self, state: &mut __H) where
    __H: Hasher
[src]

Feeds this value into the given Hasher. Read more

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 HashAccountAddress for AccountAddress[src]

fn hash(&self) -> HashValue[src]

impl LowerHex for AccountAddress[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter.

impl Ord for AccountAddress[src]

pub fn cmp(&self, other: &AccountAddress) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<AccountAddress> for AccountAddress[src]

pub fn eq(&self, other: &AccountAddress) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &AccountAddress) -> bool[src]

This method tests for !=.

impl PartialOrd<AccountAddress> for AccountAddress[src]

pub fn partial_cmp(&self, other: &AccountAddress) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Serialize for AccountAddress[src]

pub fn serialize<S>(
    &self,
    serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<'_> TryFrom<&'_ [u8]> for AccountAddress[src]

pub fn try_from(
    bytes: &[u8]
) -> Result<AccountAddress, AccountAddressParseError>
[src]

Tries to convert the provided byte array into Address.

type Error = AccountAddressParseError

The type returned in the event of a conversion error.

impl TryFrom<String> for AccountAddress[src]

type Error = AccountAddressParseError

The type returned in the event of a conversion error.

pub fn try_from(s: String) -> Result<AccountAddress, AccountAddressParseError>[src]

Performs the conversion.

impl TryFrom<Vec<u8, Global>> for AccountAddress[src]

pub fn try_from(
    bytes: Vec<u8, Global>
) -> Result<AccountAddress, AccountAddressParseError>
[src]

Tries to convert the provided byte buffer into Address.

type Error = AccountAddressParseError

The type returned in the event of a conversion error.

impl UpperHex for AccountAddress[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter.

impl Copy for AccountAddress[src]

impl Eq for AccountAddress[src]

impl StructuralEq for AccountAddress[src]

impl StructuralPartialEq for AccountAddress[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> TestOnlyHash for T where
    T: Serialize + ?Sized
[src]

pub fn test_only_hash(&self) -> HashValue[src]

Generates a hash used only for tests.

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

pub fn encode_hex<U>(&self) -> U where
    U: FromIterator<char>, 
[src]

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

pub fn encode_hex_upper<U>(&self) -> U where
    U: FromIterator<char>, 
[src]

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

Converts the given value to a String. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]