Trait polkadot_service::runtime_traits::AccountIdConversion [−][src]
pub trait AccountIdConversion<AccountId> {
fn into_sub_account<S>(&self, sub: S) -> AccountId
where
S: Encode;
fn try_from_sub_account<S>(x: &AccountId) -> Option<(Self, S)>
where
S: Decode;
fn into_account(&self) -> AccountId { ... }
fn try_from_account(a: &AccountId) -> Option<Self> { ... }
}
Expand description
This type can be converted into and possibly from an AccountId (which itself is generic).
Required methods
fn into_sub_account<S>(&self, sub: S) -> AccountId where
S: Encode,
fn into_sub_account<S>(&self, sub: S) -> AccountId where
S: Encode,
Convert this value amalgamated with the a secondary “sub” value into an account ID. This is infallible.
NOTE: The account IDs from this and from into_account
are not guaranteed to be distinct
for any given value of self
, nor are different invocations to this with different types
T
. For example, the following will all encode to the same account ID value:
self.into_sub_account(0u32)
self.into_sub_account(vec![0u8; 0])
self.into_account()
Provided methods
fn into_account(&self) -> AccountId
fn into_account(&self) -> AccountId
Convert into an account ID. This is infallible.
fn try_from_account(a: &AccountId) -> Option<Self>
fn try_from_account(a: &AccountId) -> Option<Self>
Try to convert an account ID into this type. Might not succeed.