pub struct BlockHeight(/* private fields */);
Expand description
A wrapper type representing blockchain heights.
Safe conversion from various integer types, as well as addition and subtraction, are provided.
Implementations§
Source§impl BlockHeight
impl BlockHeight
pub const fn from_u32(v: u32) -> BlockHeight
Sourcepub fn saturating_sub(self, v: u32) -> BlockHeight
pub fn saturating_sub(self, v: u32) -> BlockHeight
Subtracts the provided value from this height, returning H0
if this would result in
underflow of the wrapped u32
.
Trait Implementations§
Source§impl Add<u32> for BlockHeight
impl Add<u32> for BlockHeight
Source§impl Clone for BlockHeight
impl Clone for BlockHeight
Source§fn clone(&self) -> BlockHeight
fn clone(&self) -> BlockHeight
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 BlockHeight
impl Debug for BlockHeight
Source§impl Display for BlockHeight
impl Display for BlockHeight
Source§impl DynamicUsage for BlockHeight
impl DynamicUsage for BlockHeight
Source§impl From<BlockHeight> for i64
impl From<BlockHeight> for i64
Source§fn from(value: BlockHeight) -> i64
fn from(value: BlockHeight) -> i64
Converts to this type from the input type.
Source§impl From<BlockHeight> for u32
impl From<BlockHeight> for u32
Source§fn from(value: BlockHeight) -> u32
fn from(value: BlockHeight) -> u32
Converts to this type from the input type.
Source§impl From<BlockHeight> for u64
impl From<BlockHeight> for u64
Source§fn from(value: BlockHeight) -> u64
fn from(value: BlockHeight) -> u64
Converts to this type from the input type.
Source§impl From<u32> for BlockHeight
impl From<u32> for BlockHeight
Source§impl Hash for BlockHeight
impl Hash for BlockHeight
Source§impl Ord for BlockHeight
impl Ord for BlockHeight
Source§impl PartialEq for BlockHeight
impl PartialEq for BlockHeight
Source§impl PartialOrd for BlockHeight
impl PartialOrd for BlockHeight
Source§impl Sub<u32> for BlockHeight
impl Sub<u32> for BlockHeight
Source§impl Sub for BlockHeight
impl Sub for BlockHeight
Source§impl TestCheckpoint for BlockHeight
Available on crate feature test-dependencies
only.
impl TestCheckpoint for BlockHeight
Available on crate feature
test-dependencies
only.Source§impl TryFrom<i32> for BlockHeight
impl TryFrom<i32> for BlockHeight
Source§impl TryFrom<i64> for BlockHeight
impl TryFrom<i64> for BlockHeight
Source§impl TryFrom<u64> for BlockHeight
impl TryFrom<u64> for BlockHeight
impl Copy for BlockHeight
impl Eq for BlockHeight
impl StructuralPartialEq for BlockHeight
Auto Trait Implementations§
impl Freeze for BlockHeight
impl RefUnwindSafe for BlockHeight
impl Send for BlockHeight
impl Sync for BlockHeight
impl Unpin for BlockHeight
impl UnwindSafe for BlockHeight
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more