pub struct Address {
pub body: Vec<u8>,
pub scheme: Scheme,
pub hash_type: HashType,
pub network: Network,
}
Expand description
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
Implementations§
Source§impl Address
impl Address
Sourcepub fn new(
body: Vec<u8>,
scheme: Scheme,
hash_type: HashType,
network: Network,
) -> Self
pub fn new( body: Vec<u8>, scheme: Scheme, hash_type: HashType, network: Network, ) -> Self
Create a new address.
Sourcepub fn encode(&self) -> Result<String, EncodingError>
pub fn encode(&self) -> Result<String, EncodingError>
Attempt to convert the raw address bytes to a string.
Sourcepub fn decode(addr_str: &str) -> Result<Self, (DecodingError, DecodingError)>
pub fn decode(addr_str: &str) -> Result<Self, (DecodingError, DecodingError)>
Attempt to convert an address string into bytes.
Trait Implementations§
Source§impl Default for Address
Creates an empty Address
struct, with the body
bytes the empty vector,
Scheme::CashAddr
, HashType::Key
, and Network::Main
.
impl Default for Address
Creates an empty Address
struct, with the body
bytes the empty vector,
Scheme::CashAddr
, HashType::Key
, and Network::Main
.
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more