#[non_exhaustive]pub enum AddressFormat {
Show 28 variants
Bitcoin(BitcoinFormat),
BitcoinTestnet,
Ethereum,
BitcoinCash(Option<String>),
Litecoin,
LitecoinCash,
Dogecoin,
Dash,
Ripple,
Namecoin,
Asiacoin,
BitcoinGold,
Beetlecoin,
Blackcoin,
Clams,
Europecoin,
Feathercoin,
Fujicoin,
Hempcoin,
Peercoin,
Potcoin,
ShadowCash,
Stratis,
Syscoin,
VCash,
Verge,
Vertcoin,
ZCash,
}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(BitcoinFormat)
Bitcoin mainnet.
BitcoinTestnet
Ethereum
eth only.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
LitecoinCash
Dogecoin
Dash
Ripple
Namecoin
Asiacoin
BitcoinGold
Beetlecoin
Blackcoin
Clams
Europecoin
Feathercoin
Fujicoin
Hempcoin
Peercoin
Potcoin
ShadowCash
Stratis
Syscoin
VCash
Verge
Vertcoin
ZCash
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§const fn clone_from(&mut self, source: &Self)
const 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§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")))