std::slice - Rust
Expand description
Utilities for the slice primitive type.
See also the slice primitive type.
Most of the structs in this module are iterator types which can only be created
using a certain function. For example, slice.iter()
yields an Iter
.
A few functions are provided to create a slice from a value reference or from a raw pointer.
ChunkByAn iterator over slice in (non-overlapping) chunks separated by a predicate.ChunkByMutAn iterator over slice in (non-overlapping) mutable chunks separated
by a predicate.ChunksAn iterator over a slice in (non-overlapping) chunks ( chunk_size
elements at a
time), starting at the beginning of the slice.ChunksExactAn iterator over a slice in (non-overlapping) chunks ( chunk_size
elements at a
time), starting at the beginning of the slice.ChunksExactMutAn iterator over a slice in (non-overlapping) mutable chunks ( chunk_size
elements at a time), starting at the beginning of the slice.ChunksMutAn iterator over a slice in (non-overlapping) mutable chunks ( chunk_size
elements at a time), starting at the beginning of the slice.EscapeAsciiAn iterator over the escaped version of a byte slice.IterImmutable slice iteratorIterMutMutable slice iterator.RChunksAn iterator over a slice in (non-overlapping) chunks ( chunk_size
elements at a
time), starting at the end of the slice.RChunksExactAn iterator over a slice in (non-overlapping) chunks ( chunk_size
elements at a
time), starting at the end of the slice.RChunksExactMutAn iterator over a slice in (non-overlapping) mutable chunks ( chunk_size
elements at a time), starting at the end of the slice.RChunksMutAn iterator over a slice in (non-overlapping) mutable chunks ( chunk_size
elements at a time), starting at the end of the slice.RSplitAn iterator over subslices separated by elements that match a predicate
function, starting from the end of the slice.RSplitMutAn iterator over the subslices of the vector which are separated
by elements that match pred
, starting from the end of the slice.RSplitNAn iterator over subslices separated by elements that match a
predicate function, limited to a given number of splits, starting
from the end of the slice.RSplitNMutAn iterator over subslices separated by elements that match a
predicate function, limited to a given number of splits, starting
from the end of the slice.SplitAn iterator over subslices separated by elements that match a predicate
function.SplitInclusiveAn iterator over subslices separated by elements that match a predicate
function. Unlike Split
, it contains the matched part as a terminator
of the subslice.SplitInclusiveMutAn iterator over the mutable subslices of the vector which are separated
by elements that match pred
. Unlike SplitMut
, it contains the matched
parts in the ends of the subslices.SplitMutAn iterator over the mutable subslices of the vector which are separated
by elements that match pred
.SplitNAn iterator over subslices separated by elements that match a predicate
function, limited to a given number of splits.SplitNMutAn iterator over subslices separated by elements that match a predicate
function, limited to a given number of splits.WindowsAn iterator over overlapping subslices of length size
.ArrayChunks ExperimentalAn iterator over a slice in (non-overlapping) chunks ( N
elements at a
time), starting at the beginning of the slice.ArrayChunksMut ExperimentalAn iterator over a slice in (non-overlapping) mutable chunks ( N
elements
at a time), starting at the beginning of the slice.ArrayWindows ExperimentalA windowed iterator over a slice in overlapping chunks ( N
elements at a
time), starting at the beginning of the sliceGetDisjointMutErrorThe error type returned by get_disjoint_mut
.SliceIndexA helper trait used for indexing operations.Concat ExperimentalHelper trait for [T]::concat
.Join ExperimentalHelper trait for [T]::join
from_mutConverts a reference to T into a slice of length 1 (without copying).from_raw_parts ⚠Forms a slice from a pointer and a length.from_raw_parts_mut ⚠Performs the same functionality as from_raw_parts
, except that a
mutable slice is returned.from_refConverts a reference to T into a slice of length 1 (without copying).from_mut_ptr_range ⚠ExperimentalForms a mutable slice from a pointer range.from_ptr_range ⚠ExperimentalForms a slice from a pointer range.range ExperimentalPerforms bounds checking of a range.try_range ExperimentalPerforms bounds checking of a range without panicking.