macro_rules! non_max {
($val:expr) => { ... };
}Expand description
Creates a NonMax value at compile-time.
This macro checks at compile-time that the provided value is not the maximum value for its type. If the value is the maximum, the program will fail to compile.
ยงExamples
let x = non_max!(123u8);โ
let x = non_max!(255u8); // This fails to compileโ
let x = non_max!(127i8); // i8::MAX failsโ
let x = non_max!(u16::MAX); // Explicit MAX fails