generic-predicates 0.1.0

A taste of what const generics could enable in the future
Documentation
  • Coverage
  • 20%
    1 out of 5 items documented1 out of 3 items with examples
  • Size
  • Source code size: 3.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • lachlansneff/generic-predicates
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lachlansneff

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>();
}