[][src]Struct earth_codec::Address

pub struct Address {
    pub body: Vec<u8>,
    pub scheme: Scheme,
    pub hash_type: HashType,
    pub network: Network,
}

Struct containing the bytes and metadata of a Bitcoin Cash address. This is yeilded during decoding or consumed during encoding.

Fields

body: Vec<u8>

Address bytes

scheme: Scheme

Encoding scheme

hash_type: HashType

Hash type

network: Network

Network

Methods

impl Address[src]

pub fn new(
    body: Vec<u8>,
    scheme: Scheme,
    hash_type: HashType,
    network: Network
) -> Self
[src]

Create a new address

pub fn into_body(self) -> Vec<u8>[src]

Take address bytes

pub fn encode(&self) -> Result<String, AddressError>[src]

Attempt to convert the raw address bytes to a string

pub fn decode(
    addr_str: &str
) -> Result<Self, (CashAddrError, EarthError, Base58Error)>
[src]

Attempt to convert an address string into bytes

Trait Implementations

impl<'a> AsRef<[u8]> for Address[src]

impl Clone for Address[src]

impl Default for Address[src]

Creates an empty Address struct, with the body bytes the empty vector, Scheme::Earth, HashType::Key, and Network::Main.

impl PartialEq<Address> for Address[src]

impl Debug for Address[src]

impl StructuralPartialEq for Address[src]

Auto Trait Implementations

impl Send for Address

impl Sync for Address

impl Unpin for Address

impl UnwindSafe for Address

impl RefUnwindSafe for Address

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self