pub enum SegWitInfo {
PreSegWit,
Ambiguous,
SegWit(WitnessVersion),
}
Expand description
Defines which witness version may have an address.
The structure is required to support some ambiguity on the witness version
used by some address, since Option<
WitnessVersion
>
can’t cover that
ambiguity (see details in SegWitInfo::Ambiguous
description).
Variants
PreSegWit
P2PKH addresses
Ambiguous
P2SH addresses, which may be pre-segwit, segwit v0 (P2WPK/WSH-in-P2SH), non-taproot segwit v1 wrapped in P2SH, or future segwit versions wrapped in P2SH scripts
SegWit(WitnessVersion)
Address has a clearly defined segwit version, i.e. P2WPKH, P2WSH, P2TR or future non-P2SH-wrapped segwit address
Implementations
sourceimpl SegWitInfo
impl SegWitInfo
sourcepub fn witness_version(self) -> Option<WitnessVersion>
pub fn witness_version(self) -> Option<WitnessVersion>
Detects WitnessVersion
used in the current segwit. Returns None
for both pre-segwit and P2SH (ambiguous) addresses.
Trait Implementations
sourceimpl Clone for SegWitInfo
impl Clone for SegWitInfo
sourcefn clone(&self) -> SegWitInfo
fn clone(&self) -> SegWitInfo
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SegWitInfo
impl Debug for SegWitInfo
sourceimpl Hash for SegWitInfo
impl Hash for SegWitInfo
sourceimpl Ord for SegWitInfo
impl Ord for SegWitInfo
sourceimpl PartialEq<SegWitInfo> for SegWitInfo
impl PartialEq<SegWitInfo> for SegWitInfo
sourcefn eq(&self, other: &SegWitInfo) -> bool
fn eq(&self, other: &SegWitInfo) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SegWitInfo) -> bool
fn ne(&self, other: &SegWitInfo) -> bool
This method tests for !=
.
sourceimpl PartialOrd<SegWitInfo> for SegWitInfo
impl PartialOrd<SegWitInfo> for SegWitInfo
sourcefn partial_cmp(&self, other: &SegWitInfo) -> Option<Ordering>
fn partial_cmp(&self, other: &SegWitInfo) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for SegWitInfo
impl Eq for SegWitInfo
impl StructuralEq for SegWitInfo
impl StructuralPartialEq for SegWitInfo
Auto Trait Implementations
impl RefUnwindSafe for SegWitInfo
impl Send for SegWitInfo
impl Sync for SegWitInfo
impl Unpin for SegWitInfo
impl UnwindSafe for SegWitInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more