Enum bitcoin::util::taproot::LeafVersion
source · pub enum LeafVersion {
TapScript,
Future(FutureLeafVersion),
}
Expand description
The leaf version for tapleafs.
Variants
TapScript
BIP-342 tapscript.
Future(FutureLeafVersion)
Future leaf version.
Implementations
sourceimpl LeafVersion
impl LeafVersion
sourcepub fn from_consensus(version: u8) -> Result<Self, TaprootError>
pub fn from_consensus(version: u8) -> Result<Self, TaprootError>
Creates a LeafVersion
from consensus byte representation.
Errors
- If the last bit of the
version
is odd. - If the
version
is 0x50 (TAPROOT_ANNEX_PREFIX
).
sourcepub fn to_consensus(self) -> u8
pub fn to_consensus(self) -> u8
Returns the consensus representation of this LeafVersion
.
Trait Implementations
sourceimpl Clone for LeafVersion
impl Clone for LeafVersion
sourcefn clone(&self) -> LeafVersion
fn clone(&self) -> LeafVersion
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 moresourceimpl Debug for LeafVersion
impl Debug for LeafVersion
sourceimpl<'de> Deserialize<'de> for LeafVersion
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for LeafVersion
Available on crate feature
serde
only.Deserializes LeafVersion
as a u8
using consensus encoding.
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for LeafVersion
impl Display for LeafVersion
sourceimpl Hash for LeafVersion
impl Hash for LeafVersion
sourceimpl LowerHex for LeafVersion
impl LowerHex for LeafVersion
sourceimpl Ord for LeafVersion
impl Ord for LeafVersion
sourcefn cmp(&self, other: &LeafVersion) -> Ordering
fn cmp(&self, other: &LeafVersion) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<LeafVersion> for LeafVersion
impl PartialEq<LeafVersion> for LeafVersion
sourcefn eq(&self, other: &LeafVersion) -> bool
fn eq(&self, other: &LeafVersion) -> bool
sourceimpl PartialOrd<LeafVersion> for LeafVersion
impl PartialOrd<LeafVersion> for LeafVersion
sourcefn partial_cmp(&self, other: &LeafVersion) -> Option<Ordering>
fn partial_cmp(&self, other: &LeafVersion) -> Option<Ordering>
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 moresourceimpl Serialize for LeafVersion
Available on crate feature serde
only.
impl Serialize for LeafVersion
Available on crate feature
serde
only.Serializes LeafVersion
as a u8
using consensus encoding.
sourceimpl UpperHex for LeafVersion
impl UpperHex for LeafVersion
impl Copy for LeafVersion
impl Eq for LeafVersion
impl StructuralEq for LeafVersion
impl StructuralPartialEq for LeafVersion
Auto Trait Implementations
impl RefUnwindSafe for LeafVersion
impl Send for LeafVersion
impl Sync for LeafVersion
impl Unpin for LeafVersion
impl UnwindSafe for LeafVersion
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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