AccountIdExt

Trait AccountIdExt 

Source
pub trait AccountIdExt {
    // Required methods
    fn from_str(value: &str) -> Result<AccountId, String>;
    fn from_slice(value: &[u8]) -> Result<AccountId, String>;
    fn default() -> AccountId;
}
Expand description

Extension helpers for constructing AccountId values.

Required Methods§

Source

fn from_str(value: &str) -> Result<AccountId, String>

Parses an address string into an AccountId.

§Arguments
  • value - SS58-encoded address string.
§Returns

Returns the decoded AccountId.

§Errors

Returns an error if the address string is malformed or uses an invalid SS58 format.

Source

fn from_slice(value: &[u8]) -> Result<AccountId, String>

Decodes an AccountId from raw bytes.

§Arguments
  • value - Raw 32-byte account identifier.
§Returns

Returns the decoded AccountId.

§Errors

Returns an error if the byte slice is not exactly 32 bytes.

Source

fn default() -> AccountId

Returns the zero AccountId.

§Returns

Returns an AccountId with all bytes set to zero.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§