Macro inc_unsigned

Source
macro_rules! inc_unsigned {
    ($arg_lhs: expr) => { ... };
    ($arg_lhs: expr, by: $arg_amount: expr) => { ... };
    ($arg_lhs: expr, max: $arg_max: expr) => { ... };
    ($arg_lhs: expr, by: $arg_amount:expr, max: $arg_max: expr) => { ... };
}
Expand description

Safely increments an unsigned number. Does not panic.

use r3bl_core::*;
let mut my_u16: u16 = 0;

inc_unsigned!(my_u16);
assert_eq!(my_u16, 1);

inc_unsigned!(my_u16, by: 10);
assert_eq!(my_u16, 11);

inc_unsigned!(my_u16, max: 10);
assert_eq!(my_u16, 10);