Expand description
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.
Modules§
- test
- Module for generating automated tests
Macros§
- complete_
test - Creates a complete test suite for the type created with $create by creating using all other test macros.
- linear_
collection_ test - Test the coherence of a
LinearSizedCollection
. - size_
restricted_ collection - Tests for [
SizeRestricted
] collection with the underlying collection being the tested type.
Structs§
- Size
Restricted - A wrapper around a
LinearSizedCollection
to restricts its size. Thelength
is ensured to be between MIN and MAX including both MIN and MAX.
Enums§
- Size
Range Error - An error representing a
LinearSizedCollection
s len being out of the bound of aSizeRestricted
Traits§
- Linear
Sized Collection - A trait for linear collections which have a determinable size at any given point in time.
- ViewMut
- Used to receive a mutable view into a linear collection
Type Aliases§
- Exact
Sized - A collection which has an exact amount of elements which can’t change
- NonEmpty
- A never empty linear sized collection