checks
Adds several compile time checks for const generics.
Idea was based off of this reddit post.
Examples:
;
// All letters are alphabetic, check passes.
let pass = ; // Compiles
let pass = ; // Compiles
let pass = ; // Compiles
// Letters are not alphabetic, check fails.
let fail = ; // Compile error!
let fail = ; // Compile error!
let fail = ; // Compile error!
Custom checks can be implemented as well:
const
>: Passed;
let pass = ; // Compiles
let pass = ; // Compiles
let fail = ; // Compiler error!
Checks can also be defined with the check! macro:
check!
Full list of checks can be found on the docs.rs page.