Struct bech32::Bech32 [−][src]
pub struct Bech32 { /* fields omitted */ }
Grouping structure for the human-readable part and the data part of decoded Bech32 string.
Methods
impl Bech32
[src]
impl Bech32
pub fn new(hrp: String, data: Vec<u5>) -> Result<Bech32, Error>
[src]
pub fn new(hrp: String, data: Vec<u5>) -> Result<Bech32, Error>
Constructs a Bech32
struct if the result can be encoded as a bech32 string.
pub fn new_check_data(hrp: String, data: Vec<u8>) -> Result<Bech32, Error>
[src]
pub fn new_check_data(hrp: String, data: Vec<u8>) -> Result<Bech32, Error>
Constructs a Bech32
struct if the result can be encoded as a bech32 string. It uses
data
that is not range checked yet and as a result may return Err(Error::InvalidData)
.
This function currently allocates memory for the checked data part. See issue #19.
pub fn hrp(&self) -> &str
[src]
pub fn hrp(&self) -> &str
Returns the human readable part
pub fn data(&self) -> &[u5]
[src]
pub fn data(&self) -> &[u5]
Returns the data part as [u8]
but only using 5 bits per byte
pub fn into_parts(self) -> (String, Vec<u5>)
[src]
pub fn into_parts(self) -> (String, Vec<u5>)
Destructures the Bech32
struct into its parts
pub fn from_str_lenient(s: &str) -> Result<Bech32, Error>
[src]
pub fn from_str_lenient(s: &str) -> Result<Bech32, Error>
Parses a Bech32 string but without enforcing the 90 character limit (for lightning BOLT 11).
Trait Implementations
impl PartialEq for Bech32
[src]
impl PartialEq for Bech32
fn eq(&self, other: &Bech32) -> bool
[src]
fn eq(&self, other: &Bech32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Bech32) -> bool
[src]
fn ne(&self, other: &Bech32) -> bool
This method tests for !=
.
impl Eq for Bech32
[src]
impl Eq for Bech32
impl Debug for Bech32
[src]
impl Debug for Bech32
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Bech32
[src]
impl Clone for Bech32
fn clone(&self) -> Bech32
[src]
fn clone(&self) -> Bech32
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialOrd for Bech32
[src]
impl PartialOrd for Bech32
fn partial_cmp(&self, other: &Bech32) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Bech32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Bech32) -> bool
[src]
fn lt(&self, other: &Bech32) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Bech32) -> bool
[src]
fn le(&self, other: &Bech32) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Bech32) -> bool
[src]
fn gt(&self, other: &Bech32) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Bech32) -> bool
[src]
fn ge(&self, other: &Bech32) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Bech32
[src]
impl Ord for Bech32
fn cmp(&self, other: &Bech32) -> Ordering
[src]
fn cmp(&self, other: &Bech32) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for Bech32
[src]
impl Hash for Bech32
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Bech32
[src]
impl Display for Bech32
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl FromStr for Bech32
[src]
impl FromStr for Bech32