pub enum BitcoinFormat {
P2PKH,
P2WSH,
P2SH_P2WPKH,
Bech32,
}Expand description
Represents the format of a Bitcoin address
Variants§
P2PKH
Pay-to-Pubkey Hash, e.g. 1NoZQSmjYHUZMbqLerwmT4xfe8A6mAo8TT
P2WSH
Pay-to-Witness-Script Hash, e.g. 347N1Thc213QqfYCz3PZkjoJpNv5b14kBd
P2SH_P2WPKH
SegWit Pay-to-Witness-Public-Key Hash, e.g. 34AgLJhwXrvmkZS1o5TrcdeevMt22Nar53
Bech32
Bech32, e.g. bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx
Implementations§
Source§impl BitcoinFormat
impl BitcoinFormat
Sourcepub fn to_address_prefix<N: BitcoinNetwork>(&self) -> Vec<u8> ⓘ
pub fn to_address_prefix<N: BitcoinNetwork>(&self) -> Vec<u8> ⓘ
Returns the address prefix of the given network.
Sourcepub fn from_address_prefix(prefix: &[u8]) -> Result<Self, AddressError>
pub fn from_address_prefix(prefix: &[u8]) -> Result<Self, AddressError>
Returns the format of the given address prefix.
Sourcepub fn from_extended_private_key_version_bytes(
prefix: &[u8],
) -> Result<Self, ExtendedPrivateKeyError>
pub fn from_extended_private_key_version_bytes( prefix: &[u8], ) -> Result<Self, ExtendedPrivateKeyError>
Returns the network of the given extended private key version bytes. https://github.com/satoshilabs/slips/blob/master/slip-0132.md
Sourcepub fn from_extended_public_key_version_bytes(
prefix: &[u8],
) -> Result<Self, ExtendedPublicKeyError>
pub fn from_extended_public_key_version_bytes( prefix: &[u8], ) -> Result<Self, ExtendedPublicKeyError>
Returns the network of the given extended public key version bytes. https://github.com/satoshilabs/slips/blob/master/slip-0132.md
Trait Implementations§
Source§impl Clone for BitcoinFormat
impl Clone for BitcoinFormat
Source§fn clone(&self) -> BitcoinFormat
fn clone(&self) -> BitcoinFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BitcoinFormat
impl Debug for BitcoinFormat
Source§impl Display for BitcoinFormat
impl Display for BitcoinFormat
Source§impl Hash for BitcoinFormat
impl Hash for BitcoinFormat
Source§impl Ord for BitcoinFormat
impl Ord for BitcoinFormat
Source§fn cmp(&self, other: &BitcoinFormat) -> Ordering
fn cmp(&self, other: &BitcoinFormat) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for BitcoinFormat
impl PartialEq for BitcoinFormat
Source§impl PartialOrd for BitcoinFormat
impl PartialOrd for BitcoinFormat
Source§impl Serialize for BitcoinFormat
impl Serialize for BitcoinFormat
impl Eq for BitcoinFormat
impl Format for BitcoinFormat
impl StructuralPartialEq for BitcoinFormat
Auto Trait Implementations§
impl Freeze for BitcoinFormat
impl RefUnwindSafe for BitcoinFormat
impl Send for BitcoinFormat
impl Sync for BitcoinFormat
impl Unpin for BitcoinFormat
impl UnwindSafe for BitcoinFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more