pub struct LockTime(/* private fields */);
Implementations§
Source§impl LockTime
impl LockTime
Sourcepub const fn from_height(height: u32) -> Option<Self>
pub const fn from_height(height: u32) -> Option<Self>
Creates absolute time lock with the given block height.
Block height must be strictly less than 0x1DCD6500
, otherwise
None
is returned.
Sourcepub const fn from_unix_timestamp(timestamp: u32) -> Option<Self>
pub const fn from_unix_timestamp(timestamp: u32) -> Option<Self>
Creates absolute time lock with the given UNIX timestamp value.
Timestamp value must be greater or equal to 0x1DCD6500
, otherwise
None
is returned.
Sourcepub const fn from_consensus_u32(lock_time: u32) -> Self
pub const fn from_consensus_u32(lock_time: u32) -> Self
Converts into full u32 representation of nLockTime
value as it is
serialized in bitcoin transaction.
pub const fn to_consensus_u32(&self) -> u32
pub const fn into_consensus_u32(self) -> u32
Sourcepub const fn is_height_based(self) -> bool
pub const fn is_height_based(self) -> bool
Checks if the absolute timelock provided by the nLockTime
value
specifies height-based lock
Sourcepub const fn is_time_based(self) -> bool
pub const fn is_time_based(self) -> bool
Checks if the absolute timelock provided by the nLockTime
value
specifies time-based lock
Trait Implementations§
Source§impl ConsensusDecode for LockTime
impl ConsensusDecode for LockTime
fn consensus_decode( reader: &mut impl Read, ) -> Result<Self, ConsensusDecodeError>
fn consensus_deserialize( bytes: impl AsRef<[u8]>, ) -> Result<Self, ConsensusDecodeError>
Source§impl ConsensusEncode for LockTime
impl ConsensusEncode for LockTime
Source§impl<'de> Deserialize<'de> for LockTime
impl<'de> Deserialize<'de> for LockTime
Source§fn 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
Source§impl From<LockHeight> for LockTime
impl From<LockHeight> for LockTime
Source§fn from(lock: LockHeight) -> Self
fn from(lock: LockHeight) -> Self
Converts to this type from the input type.
Source§impl From<LockTimestamp> for LockTime
impl From<LockTimestamp> for LockTime
Source§fn from(lock: LockTimestamp) -> Self
fn from(lock: LockTimestamp) -> Self
Converts to this type from the input type.
Source§impl PartialOrd for LockTime
impl PartialOrd for LockTime
Source§impl StrictDecode for LockTime
impl StrictDecode for LockTime
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictEncode for LockTime
impl StrictEncode for LockTime
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictTuple for LockTime
impl StrictTuple for LockTime
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for LockTime
impl StrictType for LockTime
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§impl TryFrom<LockTime> for LockTimestamp
impl TryFrom<LockTime> for LockTimestamp
impl Copy for LockTime
impl Eq for LockTime
impl StrictProduct for LockTime
impl StructuralPartialEq for LockTime
Auto Trait Implementations§
impl Freeze for LockTime
impl RefUnwindSafe for LockTime
impl Send for LockTime
impl Sync for LockTime
impl Unpin for LockTime
impl UnwindSafe for LockTime
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> 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.