Struct ic_ledger_types::AccountIdentifier
source · pub struct AccountIdentifier(/* private fields */);
Expand description
AccountIdentifier is a 32-byte array. The first 4 bytes is a big-endian encoding of a CRC32 checksum of the last 28 bytes.
Implementations§
source§impl AccountIdentifier
impl AccountIdentifier
sourcepub fn new(owner: &Principal, subaccount: &Subaccount) -> Self
pub fn new(owner: &Principal, subaccount: &Subaccount) -> Self
Creates a new account identifier from a principal and subaccount.
sourcepub fn from_hex(hex_str: &str) -> Result<AccountIdentifier, String>
pub fn from_hex(hex_str: &str) -> Result<AccountIdentifier, String>
Convert hex string into AccountIdentifier.
sourcepub fn from_slice(v: &[u8]) -> Result<AccountIdentifier, AccountIdParseError>
pub fn from_slice(v: &[u8]) -> Result<AccountIdentifier, AccountIdParseError>
Converts a blob into an AccountIdentifier
.
The blob can be either:
- The 32-byte canonical format (4 byte checksum + 28 byte hash).
- The 28-byte hash.
If the 32-byte canonical format is provided, the checksum is verified.
sourcepub fn generate_checksum(&self) -> [u8; 4]
pub fn generate_checksum(&self) -> [u8; 4]
Returns the checksum of the account identifier.
Trait Implementations§
source§impl AsRef<[u8]> for AccountIdentifier
impl AsRef<[u8]> for AccountIdentifier
source§impl CandidType for AccountIdentifier
impl CandidType for AccountIdentifier
source§impl Clone for AccountIdentifier
impl Clone for AccountIdentifier
source§fn clone(&self) -> AccountIdentifier
fn clone(&self) -> AccountIdentifier
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 AccountIdentifier
impl Debug for AccountIdentifier
source§impl<'de> Deserialize<'de> for AccountIdentifier
impl<'de> Deserialize<'de> for AccountIdentifier
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for AccountIdentifier
impl Display for AccountIdentifier
source§impl Hash for AccountIdentifier
impl Hash for AccountIdentifier
source§impl Ord for AccountIdentifier
impl Ord for AccountIdentifier
source§fn cmp(&self, other: &AccountIdentifier) -> Ordering
fn cmp(&self, other: &AccountIdentifier) -> 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 AccountIdentifier
impl PartialEq for AccountIdentifier
source§fn eq(&self, other: &AccountIdentifier) -> bool
fn eq(&self, other: &AccountIdentifier) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AccountIdentifier
impl PartialOrd for AccountIdentifier
source§fn partial_cmp(&self, other: &AccountIdentifier) -> Option<Ordering>
fn partial_cmp(&self, other: &AccountIdentifier) -> 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 AccountIdentifier
impl Serialize for AccountIdentifier
impl Copy for AccountIdentifier
impl Eq for AccountIdentifier
impl StructuralPartialEq for AccountIdentifier
Auto Trait Implementations§
impl RefUnwindSafe for AccountIdentifier
impl Send for AccountIdentifier
impl Sync for AccountIdentifier
impl Unpin for AccountIdentifier
impl UnwindSafe for AccountIdentifier
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 T
impl<T> ToHex for T
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
)