feat: meta update; this is 0.2.0!

This commit is contained in:
Leonora Tindall 2021-11-07 13:04:13 -06:00
parent ce4702c7b6
commit 890174fd3e
Signed by: nora
GPG Key ID: 7A8B52EC67E09AAF
5 changed files with 30 additions and 19 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/target
Cargo.lock

5
Cargo.lock generated
View File

@ -1,5 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "nslice"
version = "0.1.0"

View File

@ -1,10 +1,11 @@
[package]
name = "nslice"
version = "0.1.0"
version = "0.2.0"
authors = ["Leonora Tindall <nora@nora.codes>"]
edition = "2018"
edition = "2021"
description = "Structures for interpreting slices of variable length as arrays"
license = "MIT"
keywords = ["memory", "slice", "array"]
categories = ["data-structures"]
repository = "https://git.nora.codes/nora/nslice"
readme = "README.md"

25
README.md Normal file
View File

@ -0,0 +1,25 @@
# 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.
```rust
# 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);
```
## License
This project is licensed MIT.

View File

@ -1,15 +1,4 @@
//! 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.
//! ```
//! 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);
//! ```
#![doc=include_str!("../README.md")]
use std::slice;
/// A reference to a region of memory which is known to contain `N` or more elements