Enum crypto_addr::AddressFormat
source · #[non_exhaustive]
pub enum AddressFormat {
Bitcoin,
BitcoinCash(Option<String>),
Litecoin,
Dogecoin,
Dash,
BitcoinGold,
Europecoin,
Ripple,
Peercoin,
Ethereum,
}Expand description
Format specification for generating addresses from public keys.
Specifies how a public key should be formatted into an address. Unit-like variants merely specify the blockchain network for which the address is intended to be used. No further information is needed for unit-like variants because this crate only supports one way to format the public key into an address string for that blockchain network.
Non-unit-like variants specify a blockchain network, but also contain additional user options that further specify how the address should be formatted.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bitcoin
Bitcoin mainnet.
BitcoinCash(Option<String>)
Bitcoin cash mainnet. Inner value is the human-readable prefix to use in the address. If it
is Some, the contained String will be used as the prefix to calculate with the cashaddr
string with and it will be included in the cashaddr. If it is None, "bitcoincash" will
be used as the prefix, but it will be omitted from the cashaddr as it is implied.
Litecoin
Litecoin mainnet.
Dogecoin
Dogecoin mainnet.
Dash
Dash mainnet.
BitcoinGold
Bitcoin Gold mainnet
Europecoin
Europecoin mainnet
Ripple
Ripple mainnet
Peercoin
Peercoin mainnet
Ethereum
Ethereum mainnet
Implementations§
source§impl AddressFormat
impl AddressFormat
sourcepub fn address_prefix(&self) -> Option<u8>
pub fn address_prefix(&self) -> Option<u8>
get the address’s prefix byte if it exists
sourcepub fn network_name(&self) -> String
pub fn network_name(&self) -> String
Get the name of the network associated with these options
Trait Implementations§
source§impl Clone for AddressFormat
impl Clone for AddressFormat
source§fn clone(&self) -> AddressFormat
fn clone(&self) -> AddressFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for AddressFormat
impl Debug for AddressFormat
source§impl Default for AddressFormat
impl Default for AddressFormat
source§fn default() -> AddressFormat
fn default() -> AddressFormat
source§impl Display for AddressFormat
impl Display for AddressFormat
source§impl From<&AddressFormat> for WIFFormat
impl From<&AddressFormat> for WIFFormat
source§fn from(opts: &AddressFormat) -> Self
fn from(opts: &AddressFormat) -> Self
Obtain a WIFFormat using the same blockchain network as an AddressFormat
source§impl FromStr for AddressFormat
impl FromStr for AddressFormat
source§fn from_str(s: &str) -> Result<Self, Error>
fn from_str(s: &str) -> Result<Self, Error>
Parse a string s to return an AddressFormat instance. s must be either the common
ticker symbol which represents the cryptocurrency or the name of the blockchain network.
Parsing is case-insensitive: e.g. "btc", "bitcoin", "BTC", and "Bitcoin" all parse
to Bitcoin, "ltc" and "litecoin" parse to Litecoin, etc.
In the case of Bitcoin Cash addresses, the optional human-readable prefix can be specified
after a :, e.g. "bch" parses to BitcoinCash(None) and "bch:hrpref parses to
BitcoinCash(Some(String::from("hrpref")))
source§impl PartialEq<AddressFormat> for AddressFormat
impl PartialEq<AddressFormat> for AddressFormat
source§fn eq(&self, other: &AddressFormat) -> bool
fn eq(&self, other: &AddressFormat) -> bool
self and other values to be equal, and is used
by ==.