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 likemapwhich 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 via
Slice::chain. - An infinitely looped slice, from
Slice::cycle. - Two interleaved slices, from
Slice::interleave. - A reversed slice, from
Slice::reverse. - An immutable sub-slice of a
Slice, fromSlice::slice. - A mutable sub-slice of a
Slice, fromSliceMut::slice_mut. - An iterator over overlapping windows of a
Slice, fromSlice::windows.
Traits§
- An extension trait providing iterator-like utilities for slices.
- A mutable slice. See
Slicefor more information.
Type Aliases§
- A split, returned by
Slice::split.