[−][src]Struct bitcoin_bech32::WitnessProgram
Witness version and program data
Methods
impl WitnessProgram
[src]
pub fn new(
version: u5,
program: Vec<u8>,
network: Network
) -> Result<WitnessProgram, Error>
[src]
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]
Converts a Witness Program to a SegWit Address
pub fn from_address(address: &str) -> Result<WitnessProgram, Error>
[src]
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]
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]
pubkey: &[u8],
network: Network
) -> Result<WitnessProgram, Error>
Extracts a WitnessProgram out of a provided script public key
pub fn validate(&self) -> Result<(), Error>
[src]
Validates the WitnessProgram against version and length constraints
pub fn version(&self) -> u5
[src]
Witness program version
pub fn program(&self) -> &[u8]
[src]
Witness program serialized as 8-bit bytes
pub fn network(&self) -> Network
[src]
Which network this witness program is intended to be run on
Trait Implementations
impl PartialEq<WitnessProgram> for WitnessProgram
[src]
fn eq(&self, other: &WitnessProgram) -> bool
[src]
fn ne(&self, other: &WitnessProgram) -> bool
[src]
impl ToString for WitnessProgram
[src]
impl Ord for WitnessProgram
[src]
fn cmp(&self, other: &WitnessProgram) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Clone for WitnessProgram
[src]
fn clone(&self) -> WitnessProgram
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for WitnessProgram
[src]
impl PartialOrd<WitnessProgram> for WitnessProgram
[src]
fn partial_cmp(&self, other: &WitnessProgram) -> Option<Ordering>
[src]
fn lt(&self, other: &WitnessProgram) -> bool
[src]
fn le(&self, other: &WitnessProgram) -> bool
[src]
fn gt(&self, other: &WitnessProgram) -> bool
[src]
fn ge(&self, other: &WitnessProgram) -> bool
[src]
impl Debug for WitnessProgram
[src]
impl Hash for WitnessProgram
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl FromStr for WitnessProgram
[src]
Auto Trait Implementations
impl Send for WitnessProgram
impl Sync for WitnessProgram
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,