Crates.io | bool_traits |
lib.rs | bool_traits |
version | 0.1.1 |
source | src |
created_at | 2024-04-07 20:34:16.060972 |
updated_at | 2024-04-07 20:43:20.62926 |
description | Use boolean expressions as trait bounds. |
homepage | |
repository | |
max_upload_size | |
id | 1199519 |
size | 3,774 |
bool_traits
Use boolean expressions as trait bounds.
#![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 > ();