Crate slice_utils
source ·Expand description
This is a collection of utilities for slices, similar to those found on
iterators. The goal is to be as close to feature-parity with iterators as
possible, while maintaining no_std compatibility.
The core of this crate is providing non-contiguous slices. For example,
Slice::chain allows you to join two slices together, clearly breaking
continuity. This results in a very Iterator-like API. Here are some
differences:
- Slices can only return references, not owned values - This disallows methods like- mapwhich require ownership semantics -- Slices are not lazy, and as such: -- Slices cannot perform arbitrary computation, because that would require allocation
These shortcomings may be alleviated by a const generic API in the future, making these possible through statically known lengths.
Structs§
- Two slices joined viaSlice::chain.
- An infinitely looped slice, fromSlice::cycle.
- Two interleaved slices, fromSlice::interleave.
- A reversed slice, fromSlice::reverse.
- An immutable sub-slice of aSlice, fromSlice::slice.
- A mutable sub-slice of aSlice, fromSliceMut::slice_mut.
- An iterator over overlapping windows of aSlice, fromSlice::windows.
Traits§
- An extension trait providing iterator-like utilities for slices.
- A mutable slice. SeeSlicefor more information.
Type Aliases§
- A split, returned bySlice::split.