const_fn_assert
This crate provide macros assertions who can be used in const function.
Example
const
const _CONST: u8 = my_const_fn;
The function below panic when running :
And this code don't compile :
const _CONST: u8 = my_const_fn; //~ ERROR any use of this value will cause an error
Available macros are cfn_assert, cfn_assert_eq, cfn_assert_ne, cfn_debug_assert, cfn_debug_assert_eq and cfn_debug_assert_ne.
Installation
This crate is available
on crates.io and can be used by
adding the following to your project's
Cargo.toml:
[]
= "0.1"
and this to your crate root (main.rs or lib.rs):
extern crate const_fn_assert;