Struct bitcoin_bech32::WitnessProgram [−][src]
pub struct WitnessProgram { /* fields omitted */ }
Witness version and program data
Methods
impl WitnessProgram
[src]
impl WitnessProgram
pub fn new(
version: u5,
program: Vec<u8>,
network: Network
) -> Result<WitnessProgram, Error>
[src]
pub fn new(
version: u5,
program: Vec<u8>,
network: Network
) -> Result<WitnessProgram, Error>
Construct a new WitnessProgram given the constituent version, witness program and network version
pub fn to_address(&self) -> String
[src]
pub fn to_address(&self) -> String
Converts a Witness Program to a SegWit Address
pub fn from_address(address: &str) -> Result<WitnessProgram, Error>
[src]
pub fn from_address(address: &str) -> Result<WitnessProgram, Error>
Decodes a segwit address into a Witness Program
Verifies that the address
contains a known human-readable part
hrp
and decodes as proper Bech32-encoded string. Allowed values of
the human-readable part correspond to the defined types in constants
pub fn to_scriptpubkey(&self) -> Vec<u8>
[src]
pub fn to_scriptpubkey(&self) -> Vec<u8>
Converts a WitnessProgram
to a script public key
The format for the output is
[version, program length, <program>]
pub fn from_scriptpubkey(
pubkey: &[u8],
network: Network
) -> Result<WitnessProgram, Error>
[src]
pub fn from_scriptpubkey(
pubkey: &[u8],
network: Network
) -> Result<WitnessProgram, Error>
Extracts a WitnessProgram out of a provided script public key
pub fn validate(&self) -> Result<(), Error>
[src]
pub fn validate(&self) -> Result<(), Error>
Validates the WitnessProgram against version and length constraints
pub fn version(&self) -> u5
[src]
pub fn version(&self) -> u5
Witness program version
pub fn program(&self) -> &[u8]
[src]
pub fn program(&self) -> &[u8]
Witness program serialized as 8-bit bytes
pub fn network(&self) -> Network
[src]
pub fn network(&self) -> Network
Which network this witness program is intended to be run on
Trait Implementations
impl PartialEq for WitnessProgram
[src]
impl PartialEq for WitnessProgram
fn eq(&self, other: &WitnessProgram) -> bool
[src]
fn eq(&self, other: &WitnessProgram) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &WitnessProgram) -> bool
[src]
fn ne(&self, other: &WitnessProgram) -> bool
This method tests for !=
.
impl Eq for WitnessProgram
[src]
impl Eq for WitnessProgram
impl Debug for WitnessProgram
[src]
impl Debug for WitnessProgram
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 WitnessProgram
[src]
impl Clone for WitnessProgram
fn clone(&self) -> WitnessProgram
[src]
fn clone(&self) -> WitnessProgram
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 WitnessProgram
[src]
impl PartialOrd for WitnessProgram
fn partial_cmp(&self, other: &WitnessProgram) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &WitnessProgram) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &WitnessProgram) -> bool
[src]
fn lt(&self, other: &WitnessProgram) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &WitnessProgram) -> bool
[src]
fn le(&self, other: &WitnessProgram) -> 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: &WitnessProgram) -> bool
[src]
fn gt(&self, other: &WitnessProgram) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &WitnessProgram) -> bool
[src]
fn ge(&self, other: &WitnessProgram) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for WitnessProgram
[src]
impl Ord for WitnessProgram
fn cmp(&self, other: &WitnessProgram) -> Ordering
[src]
fn cmp(&self, other: &WitnessProgram) -> 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 WitnessProgram
[src]
impl Hash for WitnessProgram
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 ToString for WitnessProgram
[src]
impl ToString for WitnessProgram
impl FromStr for WitnessProgram
[src]
impl FromStr for WitnessProgram
Auto Trait Implementations
impl Send for WitnessProgram
impl Send for WitnessProgram
impl Sync for WitnessProgram
impl Sync for WitnessProgram