Go to file
Leonora Tindall 057faa1342 meta: This is 0.2.1!
Re-home to codeberg.
2024-03-31 21:43:50 -05:00
src feat: meta update; this is 0.2.0! 2021-11-07 13:09:50 -06:00
.envrc build: provide Nix env and envrc for MSRV 2024-03-31 21:43:25 -05:00
.gitignore build: provide Nix env and envrc for MSRV 2024-03-31 21:43:25 -05:00
Cargo.toml meta: This is 0.2.1! 2024-03-31 21:43:50 -05:00
README.md build: specify MSRV 2024-03-31 21:42:47 -05:00
rust-toolchain.toml build: specify MSRV 2024-03-31 21:42:47 -05:00
shell.nix build: provide Nix env and envrc for MSRV 2024-03-31 21:43:25 -05:00

README.md

nslice

Structures for interpreting slices of variable length as arrays.

nslice provides MinSlice and ExactSlice for representing slices known to have either exactly or at least some compile-time-known number of values.

This is useful when dealing with a slice whose length you expect to be exactly or at least some particular length; rather than making runtime checks on each access, you can check the length once and access values freely with no copying.

# use nslice::MinSlice;

let slice = &[1, 2, 3, 4, 5, 6];
let minslice: &MinSlice<_, 3> = MinSlice::from_slice(slice).unwrap();
assert_eq!(minslice.tail.len(), 3);
assert_eq!(minslice.head[0], 1);
assert_eq!(minslice.tail[2], 6);

MSRV

This project supports Rust 1.56.1 and onward.

License

This project is licensed MIT.