pub struct BlockHeightInterval(/* private fields */);Expand description
An unsigned block interval.
Block interval is an integer type representing a difference between the heights of two blocks.
This type is not meant for constructing relative height based timelocks. It is a general
purpose block interval abstraction. For locktimes please see locktime::relative::NumberOfBlocks.
Implementations§
Source§impl BlockHeightInterval
impl BlockHeightInterval
Sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Attempt to subtract two BlockHeightIntervals, returning None if overflow occurred.
Sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Attempt to add two BlockHeightIntervals, returning None if overflow occurred.
Trait Implementations§
Source§impl<'a> Add<&'a BlockHeightInterval> for &BlockHeight
impl<'a> Add<&'a BlockHeightInterval> for &BlockHeight
Source§type Output = <BlockHeight as Add<BlockHeightInterval>>::Output
type Output = <BlockHeight as Add<BlockHeightInterval>>::Output
+ operator.Source§impl<'a> Add<&'a BlockHeightInterval> for &BlockHeightInterval
impl<'a> Add<&'a BlockHeightInterval> for &BlockHeightInterval
Source§impl Add<&BlockHeightInterval> for BlockHeight
impl Add<&BlockHeightInterval> for BlockHeight
Source§type Output = <BlockHeight as Add<BlockHeightInterval>>::Output
type Output = <BlockHeight as Add<BlockHeightInterval>>::Output
+ operator.Source§impl Add<&BlockHeightInterval> for BlockHeightInterval
impl Add<&BlockHeightInterval> for BlockHeightInterval
Source§impl Add<BlockHeightInterval> for &BlockHeight
impl Add<BlockHeightInterval> for &BlockHeight
Source§type Output = <BlockHeight as Add<BlockHeightInterval>>::Output
type Output = <BlockHeight as Add<BlockHeightInterval>>::Output
+ operator.Source§impl Add<BlockHeightInterval> for &BlockHeightInterval
impl Add<BlockHeightInterval> for &BlockHeightInterval
Source§impl Add<BlockHeightInterval> for BlockHeight
impl Add<BlockHeightInterval> for BlockHeight
Source§type Output = BlockHeight
type Output = BlockHeight
+ operator.Source§impl Add for BlockHeightInterval
impl Add for BlockHeightInterval
Source§type Output = BlockHeightInterval
type Output = BlockHeightInterval
+ operator.Source§impl AddAssign<&BlockHeightInterval> for BlockHeightInterval
impl AddAssign<&BlockHeightInterval> for BlockHeightInterval
Source§fn add_assign(&mut self, rhs: &BlockHeightInterval)
fn add_assign(&mut self, rhs: &BlockHeightInterval)
+= operation. Read moreSource§impl AddAssign for BlockHeightInterval
impl AddAssign for BlockHeightInterval
Source§fn add_assign(&mut self, rhs: BlockHeightInterval)
fn add_assign(&mut self, rhs: BlockHeightInterval)
+= operation. Read moreSource§impl<'a> Arbitrary<'a> for BlockHeightInterval
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for BlockHeightInterval
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Binary for BlockHeightInterval
impl Binary for BlockHeightInterval
Source§impl Clone for BlockHeightInterval
impl Clone for BlockHeightInterval
Source§fn clone(&self) -> BlockHeightInterval
fn clone(&self) -> BlockHeightInterval
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BlockHeightInterval
impl Debug for BlockHeightInterval
Source§impl Default for BlockHeightInterval
impl Default for BlockHeightInterval
Source§fn default() -> BlockHeightInterval
fn default() -> BlockHeightInterval
Source§impl<'de> Deserialize<'de> for BlockHeightInterval
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BlockHeightInterval
serde only.Source§fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for BlockHeightInterval
impl Display for BlockHeightInterval
Source§impl From<BlockHeightInterval> for u32
impl From<BlockHeightInterval> for u32
Source§fn from(height: BlockHeightInterval) -> Self
fn from(height: BlockHeightInterval) -> Self
Source§impl From<NumberOfBlocks> for BlockHeightInterval
impl From<NumberOfBlocks> for BlockHeightInterval
Source§fn from(h: NumberOfBlocks) -> Self
fn from(h: NumberOfBlocks) -> Self
Converts a locktime::relative::NumberOfBlocks to a BlockHeightInterval.
A relative locktime block height has a maximum value of u16::MAX where as a
BlockHeightInterval is a thin wrapper around a u32, the two types are not interchangeable.
Source§impl From<u32> for BlockHeightInterval
impl From<u32> for BlockHeightInterval
Source§impl FromStr for BlockHeightInterval
impl FromStr for BlockHeightInterval
Source§impl Hash for BlockHeightInterval
impl Hash for BlockHeightInterval
Source§impl LowerHex for BlockHeightInterval
impl LowerHex for BlockHeightInterval
Source§impl Octal for BlockHeightInterval
impl Octal for BlockHeightInterval
Source§impl Ord for BlockHeightInterval
impl Ord for BlockHeightInterval
Source§fn cmp(&self, other: &BlockHeightInterval) -> Ordering
fn cmp(&self, other: &BlockHeightInterval) -> 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 BlockHeightInterval
impl PartialEq for BlockHeightInterval
Source§impl PartialOrd for BlockHeightInterval
impl PartialOrd for BlockHeightInterval
Source§impl Serialize for BlockHeightInterval
Available on crate feature serde only.
impl Serialize for BlockHeightInterval
serde only.Source§impl<'a> Sub<&'a BlockHeightInterval> for &BlockHeight
impl<'a> Sub<&'a BlockHeightInterval> for &BlockHeight
Source§type Output = <BlockHeight as Sub<BlockHeightInterval>>::Output
type Output = <BlockHeight as Sub<BlockHeightInterval>>::Output
- operator.Source§impl<'a> Sub<&'a BlockHeightInterval> for &BlockHeightInterval
impl<'a> Sub<&'a BlockHeightInterval> for &BlockHeightInterval
Source§impl Sub<&BlockHeightInterval> for BlockHeight
impl Sub<&BlockHeightInterval> for BlockHeight
Source§type Output = <BlockHeight as Sub<BlockHeightInterval>>::Output
type Output = <BlockHeight as Sub<BlockHeightInterval>>::Output
- operator.Source§impl Sub<&BlockHeightInterval> for BlockHeightInterval
impl Sub<&BlockHeightInterval> for BlockHeightInterval
Source§impl Sub<BlockHeightInterval> for &BlockHeight
impl Sub<BlockHeightInterval> for &BlockHeight
Source§type Output = <BlockHeight as Sub<BlockHeightInterval>>::Output
type Output = <BlockHeight as Sub<BlockHeightInterval>>::Output
- operator.Source§impl Sub<BlockHeightInterval> for &BlockHeightInterval
impl Sub<BlockHeightInterval> for &BlockHeightInterval
Source§impl Sub<BlockHeightInterval> for BlockHeight
impl Sub<BlockHeightInterval> for BlockHeight
Source§type Output = BlockHeight
type Output = BlockHeight
- operator.Source§impl Sub for BlockHeightInterval
impl Sub for BlockHeightInterval
Source§type Output = BlockHeightInterval
type Output = BlockHeightInterval
- operator.Source§impl SubAssign<&BlockHeightInterval> for BlockHeightInterval
impl SubAssign<&BlockHeightInterval> for BlockHeightInterval
Source§fn sub_assign(&mut self, rhs: &BlockHeightInterval)
fn sub_assign(&mut self, rhs: &BlockHeightInterval)
-= operation. Read moreSource§impl SubAssign for BlockHeightInterval
impl SubAssign for BlockHeightInterval
Source§fn sub_assign(&mut self, rhs: BlockHeightInterval)
fn sub_assign(&mut self, rhs: BlockHeightInterval)
-= operation. Read moreSource§impl<'a> Sum<&'a BlockHeightInterval> for BlockHeightInterval
impl<'a> Sum<&'a BlockHeightInterval> for BlockHeightInterval
Source§impl Sum for BlockHeightInterval
impl Sum for BlockHeightInterval
Source§impl TryFrom<&str> for BlockHeightInterval
impl TryFrom<&str> for BlockHeightInterval
Source§impl TryFrom<BlockHeightInterval> for NumberOfBlocks
impl TryFrom<BlockHeightInterval> for NumberOfBlocks
Source§fn try_from(h: BlockHeightInterval) -> Result<Self, Self::Error>
fn try_from(h: BlockHeightInterval) -> Result<Self, Self::Error>
Converts a BlockHeightInterval to a locktime::relative::NumberOfBlocks.
A relative locktime block height has a maximum value of u16::MAX where as a
BlockHeightInterval is a thin wrapper around a u32, the two types are not interchangeable.
Source§type Error = TooBigForRelativeHeightError
type Error = TooBigForRelativeHeightError
Source§impl TryFrom<String> for BlockHeightInterval
Available on crate feature alloc only.
impl TryFrom<String> for BlockHeightInterval
alloc only.