#collection #utility

no-std srestricted

A library to manage size restricted Rust collections

3 releases (breaking)

0.3.0 Feb 22, 2023
0.2.0 Feb 22, 2023
0.1.0 Sep 22, 2021

#661 in Science

MIT license

24KB
424 lines

This crate can be used to restrict sizes of linear collections.

Contributing

Contributions are welcome. Just open an issue or make a fork and create a pull request.

The next step for the crate is adding more tests and adding more documentation (espacially examples).


lib.rs:

A create for creating and managing size restricted collections.

This crate can realise size restricted collections whichs len is clamped in between a MIN and MAX value. Those values are set with const generics. There are simple cases like NonEmpty to realise never empty collections in safe code. The main type of the crate is the SizeRestricted struct which handles the size restriction of the collection.

If you want to use your own collection type with SizeRestricted you just have to implement the LinearSizedCollection trait.

Dependencies

~165KB