Expand description
Simple static_assert
macro for compile time assertions
Uses const_panic
within const
variable to produce compile error hence only usable in const
context.
§Usage
use sa::static_assert;
static_assert!(1 == 1);
static_assert!(1 == 1, "Must be equal");
ⓘ
use sa::static_assert;
static_assert!(0 == 1, "Must be equal"); //should fail
ⓘ
use sa::static_assert;
static_assert!(0 == 1); //should fail
Macros§
- static_
assert - If expression evaluates to
true
, this macro has no effect.