Ss58Codec

Trait Ss58Codec 

Source
pub trait Ss58Codec:
    Sized
    + AsMut<[u8]>
    + AsRef<[u8]>
    + ByteArray {
    // Provided methods
    fn format_is_allowed(f: Ss58AddressFormat) -> bool { ... }
    fn from_ss58check(s: &str) -> Result<Self, PublicError> { ... }
    fn from_ss58check_with_version(
        s: &str,
    ) -> Result<(Self, Ss58AddressFormat), PublicError> { ... }
    fn from_string(s: &str) -> Result<Self, PublicError> { ... }
    fn to_ss58check_with_version(&self, version: Ss58AddressFormat) -> String { ... }
    fn to_ss58check(&self) -> String { ... }
    fn from_string_with_version(
        s: &str,
    ) -> Result<(Self, Ss58AddressFormat), PublicError> { ... }
}
Expand description

Key that can be encoded to/from SS58.

See https://docs.substrate.io/v3/advanced/ss58/ for information on the codec.

Provided Methods§

Source

fn format_is_allowed(f: Ss58AddressFormat) -> bool

A format filterer, can be used to ensure that from_ss58check family only decode for allowed identifiers. By default just refuses the two reserved identifiers.

Source

fn from_ss58check(s: &str) -> Result<Self, PublicError>

Some if the string is a properly encoded SS58Check address.

Source

fn from_ss58check_with_version( s: &str, ) -> Result<(Self, Ss58AddressFormat), PublicError>

Some if the string is a properly encoded SS58Check address.

Source

fn from_string(s: &str) -> Result<Self, PublicError>

Some if the string is a properly encoded SS58Check address, optionally with a derivation path following.

Source

fn to_ss58check_with_version(&self, version: Ss58AddressFormat) -> String

Return the ss58-check string for this key.

Source

fn to_ss58check(&self) -> String

Return the ss58-check string for this key.

Source

fn from_string_with_version( s: &str, ) -> Result<(Self, Ss58AddressFormat), PublicError>

Some if the string is a properly encoded SS58Check address, optionally with a derivation path following.

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§

Source§

impl Ss58Codec for AccountId32

Available on crate feature serde only.
Source§

impl<T: Sized + AsMut<[u8]> + AsRef<[u8]> + Public + Derive> Ss58Codec for T

Available on crate feature std only.