Trait sp_runtime::traits::AccountIdConversion [−][src]
pub trait AccountIdConversion<AccountId>: Sized { fn into_sub_account<S: Encode>(&self, sub: S) -> AccountId; fn try_from_sub_account<S: Decode>(x: &AccountId) -> Option<(Self, S)>; 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: Encode>(&self, sub: S) -> AccountId
fn into_sub_account<S: Encode>(&self, sub: S) -> AccountIdConvert 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) -> AccountIdConvert 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.