pub struct BlockHeight(pub u32);
alloc
only.Expand description
The block height, zero denotes the genesis block.
This type is not meant for constructing height based timelocks, this is a general purpose block
height abstraction. For locktimes please see locktime::absolute::Height
.
This is a thin wrapper around a u32
that may take on all values of a u32
.
Tuple Fields§
§0: u32
Implementations§
Source§impl BlockHeight
impl BlockHeight
Trait Implementations§
Source§impl Add<BlockInterval> for BlockHeight
impl Add<BlockInterval> for BlockHeight
Source§type Output = BlockHeight
type Output = BlockHeight
+
operator.Source§impl Clone for BlockHeight
impl Clone for BlockHeight
Source§fn clone(&self) -> BlockHeight
fn clone(&self) -> BlockHeight
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BlockHeight
impl Debug for BlockHeight
Source§impl<'de> Deserialize<'de> for BlockHeight
impl<'de> Deserialize<'de> for BlockHeight
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>,
Source§impl Display for BlockHeight
impl Display for BlockHeight
Source§impl From<BlockHeight> for u32
impl From<BlockHeight> for u32
Source§fn from(height: BlockHeight) -> Self
fn from(height: BlockHeight) -> Self
Source§impl From<Height> for BlockHeight
impl From<Height> for BlockHeight
Source§fn from(h: Height) -> Self
fn from(h: Height) -> Self
Converts a locktime::absolute::Height
to a BlockHeight
.
An absolute locktime block height has a maximum value of absolute::LOCK_TIME_THRESHOLD
(500,000,000) where as a BlockHeight
is a thin wrapper around a u32
, the two types are
not interchangeable.
Source§impl From<u32> for BlockHeight
impl From<u32> for BlockHeight
Source§impl FromStr for BlockHeight
impl FromStr for BlockHeight
Source§impl Hash for BlockHeight
impl Hash for BlockHeight
Source§impl Ord for BlockHeight
impl Ord for BlockHeight
Source§fn cmp(&self, other: &BlockHeight) -> Ordering
fn cmp(&self, other: &BlockHeight) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BlockHeight
impl PartialEq for BlockHeight
Source§impl PartialOrd for BlockHeight
impl PartialOrd for BlockHeight
Source§impl Serialize for BlockHeight
impl Serialize for BlockHeight
Source§impl Sub<BlockInterval> for BlockHeight
impl Sub<BlockInterval> for BlockHeight
Source§type Output = BlockHeight
type Output = BlockHeight
-
operator.Source§impl Sub for BlockHeight
impl Sub for BlockHeight
Source§type Output = BlockInterval
type Output = BlockInterval
-
operator.Source§impl TryFrom<&str> for BlockHeight
impl TryFrom<&str> for BlockHeight
Source§impl TryFrom<BlockHeight> for Height
impl TryFrom<BlockHeight> for Height
Source§fn try_from(h: BlockHeight) -> Result<Self, Self::Error>
fn try_from(h: BlockHeight) -> Result<Self, Self::Error>
Converts a BlockHeight
to a locktime::absolute::Height
.
An absolute locktime block height has a maximum value of absolute::LOCK_TIME_THRESHOLD
(500,000,000) where as a BlockHeight
is a thin wrapper around a u32
, the two types are
not interchangeable.