const_guards 0.1.3

An attribute macro for compile time constraints on const generics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
extern crate const_guards;
use const_guards::guard;

fn main() {
    let _ = A::<(), 1>::B([(); 1]);
}

#[guard(N > 0)]
pub enum A<T, const N: usize>
where
    T: Eq,
{
    B([T; N]),
}