Method lrs::num::Wsize::saturating_add

Adds another integer to this one without overflow, trimming the value to the range that can be represented in this type.

Syntax

impl Wsize {
    fn saturating_add(self, other: usize) -> Wsize
}

Arguments

NameDescription
other

Examples

let x: u8 = 200;
let y: u8 = 100;
assert!(x.saturating_add(y) == 255);