Method lrs::num::W8::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 W8 {
    fn saturating_add(self, other: u8) -> W8
}

Arguments

NameDescription
other

Examples

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