Struct casper_types::account::AccountHash
source · pub struct AccountHash(pub [u8; 32]);
Expand description
A newtype wrapping an array which contains the raw bytes of the AccountHash, a hash of Public Key and Algorithm
Tuple Fields§
§0: [u8; 32]
Implementations§
source§impl AccountHash
impl AccountHash
sourcepub const fn new(value: [u8; 32]) -> AccountHash
pub const fn new(value: [u8; 32]) -> AccountHash
Constructs a new AccountHash
instance from the raw bytes of an Public Key Account Hash.
sourcepub fn to_formatted_string(self) -> String
pub fn to_formatted_string(self) -> String
Formats the AccountHash
for users getting and putting.
sourcepub fn from_formatted_str(input: &str) -> Result<Self, FromStrError>
pub fn from_formatted_str(input: &str) -> Result<Self, FromStrError>
Parses a string formatted as per Self::to_formatted_string()
into an AccountHash
.
Trait Implementations§
source§impl AsRef<[u8]> for AccountHash
impl AsRef<[u8]> for AccountHash
source§impl Clone for AccountHash
impl Clone for AccountHash
source§fn clone(&self) -> AccountHash
fn clone(&self) -> AccountHash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AccountHash
impl Debug for AccountHash
source§impl Default for AccountHash
impl Default for AccountHash
source§fn default() -> AccountHash
fn default() -> AccountHash
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for AccountHash
impl<'de> Deserialize<'de> for AccountHash
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for AccountHash
impl Display for AccountHash
source§impl Distribution<AccountHash> for Standard
impl Distribution<AccountHash> for Standard
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> AccountHash
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> AccountHash
Generate a random value of
T
, using rng
as the source of randomness.source§impl From<&PublicKey> for AccountHash
impl From<&PublicKey> for AccountHash
source§impl From<AccountHash> for Key
impl From<AccountHash> for Key
source§fn from(account_hash: AccountHash) -> Key
fn from(account_hash: AccountHash) -> Key
Converts to this type from the input type.
source§impl FromBytes for AccountHash
impl FromBytes for AccountHash
source§impl Hash for AccountHash
impl Hash for AccountHash
source§impl Ord for AccountHash
impl Ord for AccountHash
source§fn cmp(&self, other: &AccountHash) -> Ordering
fn cmp(&self, other: &AccountHash) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for AccountHash
impl PartialEq for AccountHash
source§fn eq(&self, other: &AccountHash) -> bool
fn eq(&self, other: &AccountHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AccountHash
impl PartialOrd for AccountHash
source§fn partial_cmp(&self, other: &AccountHash) -> Option<Ordering>
fn partial_cmp(&self, other: &AccountHash) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for AccountHash
impl Serialize for AccountHash
source§impl ToBytes for AccountHash
impl ToBytes for AccountHash
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.source§impl TryFrom<&[u8]> for AccountHash
impl TryFrom<&[u8]> for AccountHash
impl Copy for AccountHash
impl Eq for AccountHash
impl StructuralEq for AccountHash
impl StructuralPartialEq for AccountHash
Auto Trait Implementations§
impl RefUnwindSafe for AccountHash
impl Send for AccountHash
impl Sync for AccountHash
impl Unpin for AccountHash
impl UnwindSafe for AccountHash
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere T: AsRef<[u8]>,
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)