Struct bp::LockTime

source ·
pub struct LockTime(/* private fields */);

Implementations§

source§

impl LockTime

source

pub const ZERO: LockTime = _

Zero time lock

source

pub const fn zero() -> LockTime

👎Deprecated since 0.10.8: use LockTime::ZERO

Create zero time lock

source

pub const fn from_height(height: u32) -> Option<LockTime>

Creates absolute time lock with the given block height.

Block height must be strictly less than 0x1DCD6500, otherwise None is returned.

source

pub const fn from_unix_timestamp(timestamp: u32) -> Option<LockTime>

Creates absolute time lock with the given UNIX timestamp value.

Timestamp value must be greater or equal to 0x1DCD6500, otherwise None is returned.

source

pub const fn from_consensus_u32(lock_time: u32) -> LockTime

Converts into full u32 representation of nLockTime value as it is serialized in bitcoin transaction.

source

pub const fn to_consensus_u32(&self) -> u32

source

pub const fn into_consensus_u32(self) -> u32

source

pub const fn is_height_based(self) -> bool

Checks if the absolute timelock provided by the nLockTime value specifies height-based lock

source

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 Clone for LockTime

source§

fn clone(&self) -> LockTime

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConsensusDecode for LockTime

source§

impl ConsensusEncode for LockTime

source§

fn consensus_encode(&self, writer: &mut impl Write) -> Result<usize, IoError>

source§

fn consensus_serialize(&self) -> Vec<u8>

source§

impl Debug for LockTime

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for LockTime

source§

fn default() -> LockTime

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for LockTime

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<LockTime, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<LockHeight> for LockTime

source§

fn from(lock: LockHeight) -> LockTime

Converts to this type from the input type.
source§

impl From<LockTimestamp> for LockTime

source§

fn from(lock: LockTimestamp) -> LockTime

Converts to this type from the input type.
source§

impl Hash for LockTime

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for LockTime

source§

fn eq(&self, other: &LockTime) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for LockTime

source§

fn partial_cmp(&self, other: &LockTime) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for LockTime

source§

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 LockTime

source§

impl StrictEncode for LockTime

source§

fn strict_encode<W>(&self, writer: W) -> Result<W, Error>
where W: TypedWrite,

source§

fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>

source§

impl StrictTuple for LockTime

source§

impl StrictType for LockTime

source§

const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN

source§

fn strict_name() -> Option<TypeName>

source§

impl TryFrom<LockTime> for LockHeight

§

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>

Performs the conversion.
source§

impl TryFrom<LockTime> for LockTimestamp

§

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>

Performs the conversion.
source§

impl Copy for LockTime

source§

impl Eq for LockTime

source§

impl StrictProduct for LockTime

source§

impl StructuralPartialEq for LockTime

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> StrictDumb for T
where T: StrictType + Default,

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> VerifyEq for T
where T: Eq,

source§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,