Crate slice_utils
source ·Expand description
§::slice-utils
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 an Iterator-like API. Here are some differences:
Slices can only return references, not owned values- This disallows methods like
mapwhich require ownership semantics - This may be fixable through a thorough refactor
- This disallows methods like
Slices are not lazy, and as such:Slices cannot perform arbitrary computation, because that would require either allocation or ownership semantics- This may be alleviated by a const generic API in the future
§License
Licensed under the MIT license.
Structs§
- An iterator over const-sized chunks of a
Slice, fromSlice::array_chunksorSlice::array_chunks_exact. - An iterator over overlapping windows of a
Slice, fromSlice::windows. - 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.