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§

source

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.

source

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.

source

fn to_u128(&self) -> u128

Implementations on Foreign Types§

source§

impl WrappingTrait for u8

source§

impl WrappingTrait for u32

source§

impl WrappingTrait for u16

source§

impl WrappingTrait for u64

source§

impl WrappingTrait for ()

Implementors§

source§

impl<T, const MAX: u64> WrappingTrait for FractionalWrapping<T, MAX>where T: From<u8> + TryFrom<u64> + TryFrom<u128> + Into<u128> + Add<Output = T> + Sub<Output = T> + Rem<Output = T> + PartialOrd + Copy + Init + Debug,