pub struct Height(/* private fields */);
Expand description
An absolute block height, guaranteed to always contain a valid height value.
Implementations§
source§impl Height
impl Height
sourcepub const fn min_value() -> Self
👎Deprecated since 0.31.0: Use Self::MIN instead
pub const fn min_value() -> Self
The minimum absolute block height (0), the genesis block.
This is provided for consistency with Rust 1.41.1, newer code should use Height::MIN
.
sourcepub const fn max_value() -> Self
👎Deprecated since 0.31.0: Use Self::MAX instead
pub const fn max_value() -> Self
The maximum absolute block height.
This is provided for consistency with Rust 1.41.1, newer code should use Height::MAX
.
sourcepub fn to_consensus_u32(self) -> u32
pub fn to_consensus_u32(self) -> u32
Converts this Height
to its inner u32
value.
Examples
use bitcoin::absolute::LockTime;
let n_lock_time: u32 = 741521;
let lock_time = LockTime::from_consensus(n_lock_time);
assert!(lock_time.is_block_height());
assert_eq!(lock_time.to_consensus_u32(), n_lock_time);
Trait Implementations§
source§impl<'de> Deserialize<'de> for Height
impl<'de> Deserialize<'de> for Height
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 FromHexStr for Height
impl FromHexStr for Height
source§impl Ord for Height
impl Ord for Height
source§impl PartialEq<Height> for Height
impl PartialEq<Height> for Height
source§impl PartialOrd<Height> for Height
impl PartialOrd<Height> for Height
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 moreimpl Copy for Height
impl Eq for Height
impl StructuralEq for Height
impl StructuralPartialEq for Height
Auto Trait Implementations§
impl RefUnwindSafe for Height
impl Send for Height
impl Sync for Height
impl Unpin for Height
impl UnwindSafe for Height
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