3 stable releases
2.0.0 | Dec 2, 2021 |
---|---|
1.0.1 | Apr 22, 2020 |
1.0.0 | Apr 21, 2020 |
#2 in #static-assert
46 downloads per month
Used in restbl
4KB
static-assert
Simple static_assert
macro for compile time assertions.
Uses const_panic
within const
variable to produce compile error hence only usable in const
context
Requirements
- Rust 1.57
lib.rs
:
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