[][src]Attribute Macro saturating_arithmetic::saturateit

#[saturateit]

Make addition and multiplication saturating in the annotated function.

Example

This example is not tested
#[saturateit]
fn oops() {
    let a: u32 = std::u32::MAX;
    let b: u32 = 2;
    let r = a + b;
    assert_eq!(a, r)
}