Crates.io | const-slice |
lib.rs | const-slice |
version | 0.1.0 |
source | src |
created_at | 2022-10-17 13:46:04.963858 |
updated_at | 2022-10-17 13:46:04.963858 |
description | working with slices in compile-time constants |
homepage | |
repository | |
max_upload_size | |
id | 690171 |
size | 7,792 |
Compile-time constant variants of several slice types over dynamically allocated types, implemented as slices over a fixed-capacity array (controlled by const generics).
The types in this crate will panic at compile-time if they would exceed the size of their array (currently produces a very unhelpful error - see #51999)
const FIRST: &str = "mary had a";
const SECOND: &str = " little lamb.";
const BOTH: ConstString<32> = ConstString::from_str(FIRST).with_str(SECOND);
assert_eq!(BOTH, ConstString::from_str("mary had a little lamb."));