pub struct ShortHrp(/* private fields */);
Expand description
Short human-readable address part
Implementations§
Source§impl ShortHrp
impl ShortHrp
Sourcepub const MAX_HRP_LENGTH: usize = 5usize
pub const MAX_HRP_LENGTH: usize = 5usize
Maximum length of the human-readable part of the address
Sourcepub fn new(hrp: Hrp) -> Option<Self>
pub fn new(hrp: Hrp) -> Option<Self>
Create a new instance.
Returns None
if length of human-readable part is longer than Self::MAX_HRP_LENGTH
.
Methods from Deref<Target = Hrp>§
pub fn byte_iter(&self) -> ByteIter<'_>
pub fn byte_iter(&self) -> ByteIter<'_>
Creates a byte iterator over the ASCII byte values (ASCII characters) of this HRP.
If an uppercase HRP was parsed during object construction then this iterator will yield
uppercase ASCII char
s. For lowercase bytes see [Self::lowercase_byte_iter
]
pub fn char_iter(&self) -> CharIter<'_>
pub fn char_iter(&self) -> CharIter<'_>
Creates a character iterator over the ASCII characters of this HRP.
If an uppercase HRP was parsed during object construction then this iterator will yield
uppercase ASCII char
s. For lowercase bytes see [Self::lowercase_char_iter
].
pub fn lowercase_byte_iter(&self) -> LowercaseByteIter<'_>
pub fn lowercase_byte_iter(&self) -> LowercaseByteIter<'_>
Creates a lowercase iterator over the byte values (ASCII characters) of this HRP.
pub fn lowercase_char_iter(&self) -> LowercaseCharIter<'_>
pub fn lowercase_char_iter(&self) -> LowercaseCharIter<'_>
Creates a lowercase character iterator over the ASCII characters of this HRP.
pub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length (number of characters) of the human-readable part.
Guaranteed to be between 1 and 83 inclusive.
pub fn is_valid_segwit(&self) -> bool
pub fn is_valid_segwit(&self) -> bool
Returns true
if this HRP is valid according to the bips.
BIP-173 states that the HRP must be either “bc” or “tb”.
pub fn is_valid_on_mainnet(&self) -> bool
pub fn is_valid_on_mainnet(&self) -> bool
Returns true
if this HRP is valid on the Bitcoin network i.e., HRP is “bc”.
pub fn is_valid_on_testnet(&self) -> bool
pub fn is_valid_on_testnet(&self) -> bool
Returns true
if this HRP is valid on the Bitcoin testnet network i.e., HRP is “tb”.
pub fn is_valid_on_signet(&self) -> bool
pub fn is_valid_on_signet(&self) -> bool
Returns true
if this HRP is valid on the Bitcoin signet network i.e., HRP is “tb”.
pub fn is_valid_on_regtest(&self) -> bool
pub fn is_valid_on_regtest(&self) -> bool
Returns true
if this HRP is valid on the Bitcoin regtest network i.e., HRP is “bcrt”.
Trait Implementations§
impl Copy for ShortHrp
impl Eq for ShortHrp
impl StructuralPartialEq for ShortHrp
Auto Trait Implementations§
impl Freeze for ShortHrp
impl RefUnwindSafe for ShortHrp
impl Send for ShortHrp
impl Sync for ShortHrp
impl Unpin for ShortHrp
impl UnwindSafe for ShortHrp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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>
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>
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