Slots Slice
This is a small crate that aims provides utilities for manipulating slices of optional values, referred to as Slots<T>.
Features
- Conveniently manipulate slices of optional values.
- Perform operations on slots such as counting, checking emptiness and fullness, and retrieving values and entries.
- Macro syntax for creating and assigning.
Usage
Bring the prelude into scope:
use *;
The highlight of the crate are SlotsTrait and SlotsMutTrait which add methods for accessing and manipulating slots immutably and mutably. These operate on anything that implements AsRef<[T]> so they are available right away on structs such as array and Vec<T>.
Overview of SlotsTrait:
use *;
let slots = ;
assert_eq!;
assert!;
assert!;
assert_eq!;
assert_eq!;
assert_eq!;
SlotsMutTrait provide the mutable version of SlotsTrait as well as collapse functionality.
use *;
let mut slots = ;
assert_eq!;
assert_eq!;
slots.collapse_front;
assert_eq!;