Uses new Rust 2021
|0.1.3||Sep 22, 2022|
|0.1.2||Sep 22, 2022|
|0.1.1||Sep 22, 2022|
|0.1.0||Sep 22, 2022|
#486 in Data structures
74 downloads per month
Slices and vectors that are statically guaranteed to be not empty.
This crate is particularly useful for various operations on slices or vectors that would otherwise return an option now return the value with no performance penalty.
This crate is on crates.io and can be used by adding
to your dependencies in your project's
[dependencies] not_empty = "0.1"
View the full reference on
allocenables the use of allocated types through the alloc crate.
serdeenables the use of the
serdecrate to serialize and deserialize any
stdenables the use of the standard library.
Note: A compiler error is thrown if both
std features are
enabled. Only choose up to one.
std feature is enabled by default.
There are other packages that solve this solution. When searching for my own, I primarily came across two other packages:
nonemptywhich only supported vectors and didn't have a solution to working elegantly with iterators. Also, interoperability between its exported
NonEmptytype and other slices or vectors left much to be desired from an architectural support. To be pedantic, I was jaded that the
NonEmptytype was larger than a standard vector for non-zero sized types.
non-empty-vecdid not enlarge the type, which was good, but it did not meet my needs for interoperability as well.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.