Implement Rem for Weight
`Weight` implements `Div` but not `Rem` Add `Rem` impl for `Weight`
This commit is contained in:
parent
72823df014
commit
4787aa1f89
|
@ -198,6 +198,16 @@ crate::internal_macros::impl_op_for_references! {
|
|||
|
||||
fn div(self, rhs: Weight) -> Self::Output { self.to_wu() / rhs.to_wu() }
|
||||
}
|
||||
impl ops::Rem<u64> for Weight {
|
||||
type Output = Weight;
|
||||
|
||||
fn rem(self, rhs: u64) -> Self::Output { Weight(self.0 % rhs) }
|
||||
}
|
||||
impl ops::Rem<Weight> for Weight {
|
||||
type Output = u64;
|
||||
|
||||
fn rem(self, rhs: Weight) -> Self::Output { self.0 % rhs.0 }
|
||||
}
|
||||
}
|
||||
crate::internal_macros::impl_add_assign!(Weight);
|
||||
crate::internal_macros::impl_sub_assign!(Weight);
|
||||
|
@ -210,6 +220,10 @@ impl ops::DivAssign<u64> for Weight {
|
|||
fn div_assign(&mut self, rhs: u64) { self.0 /= rhs }
|
||||
}
|
||||
|
||||
impl ops::RemAssign<u64> for Weight {
|
||||
fn rem_assign(&mut self, rhs: u64) { self.0 %= rhs }
|
||||
}
|
||||
|
||||
impl core::iter::Sum for Weight {
|
||||
fn sum<I>(iter: I) -> Self
|
||||
where
|
||||
|
|
Loading…
Reference in New Issue