generic-predicates

Crates.iogeneric-predicates
lib.rsgeneric-predicates
version0.1.0
sourcesrc
created_at2022-06-24 07:10:43.549489
updated_at2022-06-24 07:10:43.549489
descriptionA taste of what const generics could enable in the future
homepage
repositoryhttps://github.com/lachlansneff/generic-predicates
max_upload_size
id612245
size4,067
Lachlan Sneff (lachlansneff)

documentation

README

A taste of what const generics could enable in the future

#![feature(generic_const_exprs)]

use generic_predicates::generic_predicates;

generic_predicates! {
    pub fn foo<const N: usize>()
    where
        (N > 23, "`N` must be greater than 23")
    {

    }
}

fn main() {
    // This compiles.
    foo::<24>();

    // This doesn't.
    foo::<23>();
}
Commit count: 9

cargo fmt