devela::num::logic

Macro const_bool

Source
macro_rules! const_bool {
    ($bool:expr) => { ... };
}
Expand description

Converts a const bool expression to a type-level boolean.

Internally, it leverages the ConstBool trait and a trick related to array sizes:

  • Arrays of size [(); 0] are mapped to False.
  • Arrays of size [(); 1] are mapped to True.

§Examples

const _: True = const_bool![4 == 4];
const _: True = const_bool![3 == 4];