pub enum LeafVersion {
TapScript,
Future(FutureLeafVersion),
}Expand description
The leaf version for tapleafs.
Variants§
Implementations§
Source§impl LeafVersion
impl LeafVersion
Sourcepub fn from_consensus(version: u8) -> Result<LeafVersion, TaprootError>
pub fn from_consensus(version: u8) -> Result<LeafVersion, TaprootError>
Creates a LeafVersion from consensus byte representation.
§Errors
- If the last bit of the
versionis odd. - If the
versionis 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§
Source§impl Clone for LeafVersion
impl Clone for LeafVersion
Source§fn clone(&self) -> LeafVersion
fn clone(&self) -> LeafVersion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LeafVersion
impl Debug for LeafVersion
Source§impl<'de> Deserialize<'de> for LeafVersion
Available on crate feature serde only.Deserializes LeafVersion as a u8 using consensus encoding.
impl<'de> Deserialize<'de> for LeafVersion
Available on crate feature
serde only.Deserializes LeafVersion as a u8 using consensus encoding.
Source§fn deserialize<D>(
deserializer: D,
) -> Result<LeafVersion, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<LeafVersion, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for LeafVersion
impl Display for LeafVersion
Source§impl Hash for LeafVersion
impl Hash for LeafVersion
Source§impl LowerHex for LeafVersion
impl LowerHex for LeafVersion
Source§impl Ord for LeafVersion
impl Ord for LeafVersion
Source§fn cmp(&self, other: &LeafVersion) -> Ordering
fn cmp(&self, other: &LeafVersion) -> Ordering
1.21.0 · Source§fn 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
Source§impl PartialEq for LeafVersion
impl PartialEq for LeafVersion
Source§impl PartialOrd for LeafVersion
impl PartialOrd for LeafVersion
Source§impl Serialize for LeafVersion
Available on crate feature serde only.Serializes LeafVersion as a u8 using consensus encoding.
impl Serialize for LeafVersion
Available on crate feature
serde only.Serializes LeafVersion as a u8 using consensus encoding.
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl StrictDecode for LeafVersion
impl StrictDecode for LeafVersion
fn strict_decode( reader: &mut impl TypedRead, ) -> Result<LeafVersion, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDeserialize for LeafVersion
impl StrictDeserialize for LeafVersion
fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8>, 0, MAX>, ) -> Result<Self, DeserializeError>
fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path>, ) -> Result<Self, DeserializeError>
Source§impl StrictDumb for LeafVersion
impl StrictDumb for LeafVersion
fn strict_dumb() -> LeafVersion
Source§impl StrictEncode for LeafVersion
impl StrictEncode for LeafVersion
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictSerialize for LeafVersion
impl StrictSerialize for LeafVersion
fn strict_serialized_len<const MAX: usize>(&self) -> Result<usize, Error>
fn to_strict_serialized<const MAX: usize>( &self, ) -> Result<Confined<Vec<u8>, 0, MAX>, SerializeError>
fn strict_serialize_to_file<const MAX: usize>( &self, path: impl AsRef<Path>, ) -> Result<(), SerializeError>
Source§impl StrictTuple for LeafVersion
impl StrictTuple for LeafVersion
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for LeafVersion
impl StrictType for LeafVersion
const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN
fn strict_name() -> Option<TypeName>
Source§impl UpperHex for LeafVersion
impl UpperHex for LeafVersion
impl Copy for LeafVersion
impl Eq for LeafVersion
impl StrictProduct for LeafVersion
impl StructuralPartialEq for LeafVersion
Auto Trait Implementations§
impl Freeze for LeafVersion
impl RefUnwindSafe for LeafVersion
impl Send for LeafVersion
impl Sync for LeafVersion
impl Unpin for LeafVersion
impl UnwindSafe for LeafVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.