bool_traits 0.1.1

Use boolean expressions as trait bounds.
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented1 out of 3 items with examples
  • Size
  • Source code size: 3.42 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 540.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • melvdlin

bool_traits

bool_traits

Use boolean expressions as trait bounds.

Examples

#![feature(generic_const_exprs)]

use bool_traits::*;

fn create_small_u8_array<const N: usize>() -> [u8; N]
    where
        (): True<{ N <= 4 }>,
{
    [0; N]
}
// this compiles:
let array = create_small_u8_array::<3 > ();
// this does not:
let array = create_small_u8_array::<5 > ();