Trait r3_portkit::num::wrapping::WrappingTrait
source · pub trait WrappingTrait: Init + Copy + Debug {
// Required methods
fn wrapping_add_assign64(&mut self, rhs: u64) -> bool;
fn wrapping_add_assign128_multi32(&mut self, rhs: u128) -> u32;
fn to_u128(&self) -> u128;
}
Expand description
Represents a counter type that wraps around when incremented past a
predetermined upper bound MAX
(this bound is not exposed).
Required Methods§
sourcefn wrapping_add_assign64(&mut self, rhs: u64) -> bool
fn wrapping_add_assign64(&mut self, rhs: u64) -> bool
Add a value to self
. Returns true
iff wrap-around has occurred.
rhs
must be less than or equal to MAX
.
sourcefn wrapping_add_assign128_multi32(&mut self, rhs: u128) -> u32
fn wrapping_add_assign128_multi32(&mut self, rhs: u128) -> u32
Add a value to self
. Returns the number of times for which wrap-around
has occurred.
The result must not overflow.