Compare commits
3 Commits
890174fd3e
...
057faa1342
Author | SHA1 | Date |
---|---|---|
Leonora Tindall | 057faa1342 | |
Leonora Tindall | ff4c4a72b6 | |
Leonora Tindall | 60aa918513 |
|
@ -1,2 +1,3 @@
|
||||||
/target
|
/target
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
.direnv
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
name = "nslice"
|
name = "nslice"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
authors = ["Leonora Tindall <nora@nora.codes>"]
|
authors = ["Leonora Tindall <nora@nora.codes>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Structures for interpreting slices of variable length as arrays"
|
description = "Structures for interpreting slices of variable length as arrays"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
keywords = ["memory", "slice", "array"]
|
keywords = ["memory", "slice", "array"]
|
||||||
categories = ["data-structures"]
|
categories = ["data-structures"]
|
||||||
repository = "https://git.nora.codes/nora/nslice"
|
repository = "https://codeberg.org/noracodes/nslice"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
rust-version = "1.56.1"
|
||||||
|
|
|
@ -8,7 +8,7 @@ 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
|
This is useful when dealing with a slice whose length you expect to be exactly
|
||||||
or at least some particular length;
|
or at least some particular length;
|
||||||
rather than making runtime checks on each access,
|
rather than making runtime checks on each access,
|
||||||
you can check the length once and access values freely with no copying.
|
you can check the length once and access values freely with no copying.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
# use nslice::MinSlice;
|
# use nslice::MinSlice;
|
||||||
|
@ -18,8 +18,13 @@ let minslice: &MinSlice<_, 3> = MinSlice::from_slice(slice).unwrap();
|
||||||
assert_eq!(minslice.tail.len(), 3);
|
assert_eq!(minslice.tail.len(), 3);
|
||||||
assert_eq!(minslice.head[0], 1);
|
assert_eq!(minslice.head[0], 1);
|
||||||
assert_eq!(minslice.tail[2], 6);
|
assert_eq!(minslice.tail[2], 6);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## MSRV
|
||||||
|
|
||||||
|
This project supports Rust 1.56.1 and onward.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed MIT.
|
This project is licensed MIT.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "1.56.1"
|
|
@ -0,0 +1,14 @@
|
||||||
|
let
|
||||||
|
rust_overlay = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
|
||||||
|
pkgs = import <nixpkgs> { overlays = [ rust_overlay ]; };
|
||||||
|
rustVersion = "1.56.1";
|
||||||
|
rust = pkgs.rust-bin.stable.${rustVersion}.default;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
rust
|
||||||
|
] ++ (with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
]);
|
||||||
|
RUST_BACKTRACE = 1;
|
||||||
|
}
|
Loading…
Reference in New Issue