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