Struct bpstd::LockHeight 
source · 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
§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§fn eq(&self, other: &LockHeight) -> bool
 
fn eq(&self, other: &LockHeight) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl PartialOrd for LockHeight
 
impl PartialOrd for LockHeight
source§fn partial_cmp(&self, other: &LockHeight) -> Option<Ordering>
 
fn partial_cmp(&self, other: &LockHeight) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
 
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 moresource§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
§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
§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<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.