#slice #compile-time #array #variant #constant #const #size

const-slice

working with slices in compile-time constants

1 unstable release

0.1.0 Oct 17, 2022

#73 in #constant

MIT/Apache

8KB
113 lines

const-slice

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)

Examples

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."));

lib.rs:

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)

No runtime deps