Trait AddressCodec

Source
pub trait AddressCodec {
    type EncodingError;
    type DecodingError;

    // Required methods
    fn encode(
        raw: &[u8],
        hash_type: HashType,
        network: Network,
    ) -> Result<String, Self::EncodingError>;
    fn decode(s: &str) -> Result<Address, Self::DecodingError>;
}
Expand description

A trait providing an interface for encoding and decoding the Address struct for each address scheme.

Required Associated Types§

Required Methods§

Source

fn encode( raw: &[u8], hash_type: HashType, network: Network, ) -> Result<String, Self::EncodingError>

Attempt to convert the raw address bytes to a string.

Source

fn decode(s: &str) -> Result<Address, Self::DecodingError>

Attempt to convert the address string to bytes.

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§