Use impl_op_for_references for block height/interval
We have a new macro for implementing ops with a bunch of reference combos. Lets use it for block `Height` and `Interval`. This patch is strictly additive.
This commit is contained in:
parent
f5e17914b6
commit
9d55922952
|
@ -171,6 +171,7 @@ impl fmt::Display for TooBigForRelativeBlockHeightError {
|
|||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for TooBigForRelativeBlockHeightError {}
|
||||
|
||||
crate::internal_macros::impl_op_for_references! {
|
||||
// height - height = interval
|
||||
impl ops::Sub<BlockHeight> for BlockHeight {
|
||||
type Output = BlockInterval;
|
||||
|
@ -220,6 +221,7 @@ impl ops::Sub<BlockInterval> for BlockInterval {
|
|||
BlockInterval::from_u32(height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::AddAssign<BlockInterval> for BlockInterval {
|
||||
fn add_assign(&mut self, rhs: BlockInterval) { self.0 = self.to_u32() + rhs.to_u32(); }
|
||||
|
|
Loading…
Reference in New Issue