macro_rules! mode {
($value:literal) => { ... };
($value:expr) => { ... };
}Expand description
Creates a Mode from a u8 literal or expression.
Literals are validated at compile time. Expressions are validated at runtime.
§Panics
The expression form panics if the reserved high bit is set. Use Mode::new or
Mode::try_from to validate untrusted values without panicking.
§Examples
use commonware_codec::{Mode, mode};
const ENABLED: Mode = mode!(1);
assert_eq!(u8::from(ENABLED), 1);ⓘ
use commonware_codec::{Mode, mode};
const INVALID: Mode = mode!(0x80);