pub struct LockHeight(/* private fields */);
Expand description
Value for a transaction nTimeLock
field which is guaranteed to represent a
block height number which is always less than 500000000.
Implementations§
Source§impl LockHeight
impl LockHeight
Sourcepub fn anytime() -> LockHeight
pub fn anytime() -> LockHeight
Create zero time lock
Sourcepub fn from_height(height: u32) -> Option<LockHeight>
pub fn from_height(height: u32) -> Option<LockHeight>
Creates absolute time lock with the given block height.
Block height must be strictly less than 0x1DCD6500
, otherwise
None
is returned.
pub const fn try_from_lock_time( lock_time: LockTime, ) -> Result<LockHeight, InvalidTimelock>
pub const fn try_from_consensus_u32( lock_time: u32, ) -> Result<LockHeight, InvalidTimelock>
Sourcepub const fn to_consensus_u32(&self) -> u32
pub const fn to_consensus_u32(&self) -> u32
Converts into full u32 representation of nLockTime
value as it is
serialized in bitcoin transaction.
Sourcepub const fn into_consensus_u32(self) -> u32
pub const fn into_consensus_u32(self) -> u32
Converts into full u32 representation of nLockTime
value as it is
serialized in bitcoin transaction.
Sourcepub fn to_lock_time(&self) -> LockTime
pub fn to_lock_time(&self) -> LockTime
Converts into LockTime
representation.
Sourcepub fn into_lock_time(self) -> LockTime
pub fn into_lock_time(self) -> LockTime
Converts into LockTime
representation.
Trait Implementations§
Source§impl Clone for LockHeight
impl Clone for LockHeight
Source§fn clone(&self) -> LockHeight
fn clone(&self) -> LockHeight
Returns a copy 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 LockHeight
impl Debug for LockHeight
Source§impl Decode for LockHeight
impl Decode for LockHeight
fn decode(reader: &mut impl Read) -> Result<LockHeight, DecodeError>
fn deserialize(bytes: impl AsRef<[u8]>) -> Result<Self, PsbtError>
Source§impl Default for LockHeight
impl Default for LockHeight
Source§fn default() -> LockHeight
fn default() -> LockHeight
Returns the “default value” for a type. Read more
Source§impl Display for LockHeight
impl Display for LockHeight
Source§impl Encode for LockHeight
impl Encode for LockHeight
Source§impl From<LockHeight> for LockTime
impl From<LockHeight> for LockTime
Source§fn from(lock: LockHeight) -> LockTime
fn from(lock: LockHeight) -> LockTime
Converts to this type from the input type.
Source§impl FromStr for LockHeight
impl FromStr for LockHeight
Source§type Err = TimelockParseError
type Err = TimelockParseError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<LockHeight, <LockHeight as FromStr>::Err>
fn from_str(s: &str) -> Result<LockHeight, <LockHeight as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moreSource§impl Hash for LockHeight
impl Hash for LockHeight
Source§impl Ord for LockHeight
impl Ord for LockHeight
Source§fn cmp(&self, other: &LockHeight) -> Ordering
fn cmp(&self, other: &LockHeight) -> 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 LockHeight
impl PartialEq for LockHeight
Source§impl PartialOrd for LockHeight
impl PartialOrd for LockHeight
Source§impl StrictDecode for LockHeight
impl StrictDecode for LockHeight
fn strict_decode(reader: &mut impl TypedRead) -> Result<LockHeight, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictEncode for LockHeight
impl StrictEncode for LockHeight
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictTuple for LockHeight
impl StrictTuple for LockHeight
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for LockHeight
impl StrictType for LockHeight
const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN
fn strict_name() -> Option<TypeName>
Source§impl TryFrom<LockTime> for LockHeight
impl TryFrom<LockTime> for LockHeight
Source§type Error = InvalidTimelock
type Error = InvalidTimelock
The type returned in the event of a conversion error.
Source§fn try_from(
lock_time: LockTime,
) -> Result<LockHeight, <LockHeight as TryFrom<LockTime>>::Error>
fn try_from( lock_time: LockTime, ) -> Result<LockHeight, <LockHeight as TryFrom<LockTime>>::Error>
Performs the conversion.
Source§impl TryFrom<u32> for LockHeight
impl TryFrom<u32> for LockHeight
Source§type Error = InvalidTimelock
type Error = InvalidTimelock
The type returned in the event of a conversion error.
Source§fn try_from(
value: u32,
) -> Result<LockHeight, <LockHeight as TryFrom<u32>>::Error>
fn try_from( value: u32, ) -> Result<LockHeight, <LockHeight as TryFrom<u32>>::Error>
Performs the conversion.
impl Copy for LockHeight
impl Eq for LockHeight
impl StrictProduct for LockHeight
impl StructuralPartialEq for LockHeight
Auto Trait Implementations§
impl Freeze for LockHeight
impl RefUnwindSafe for LockHeight
impl Send for LockHeight
impl Sync for LockHeight
impl Unpin for LockHeight
impl UnwindSafe for LockHeight
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.