Module slice

Source
Expand description

const fn equivalents of slice methods.

Macros§

try_into_array
Tries to convert from &[T] to &[T; N], usable in consts, but not in const fns.

Structs§

Chunks
Const equivalent of core::slice::Chunks
ChunksExact
Const equivalent of core::slice::ChunksExact
ChunksExactRev
Const equivalent of core::iter::Rev<core::slice::ChunksExact>
ChunksRev
Const equivalent of core::iter::Rev<core::slice::Chunks>
Iter
Const equivalent of core::slice::Iter.
IterCopied
A const equivalent of iter::Copied<slice::Iter<'a, T>>.
IterCopiedRev
A const equivalent of iter::Rev<iter::Copied<slice::Iter<'a, T>>>
IterRev
Const equivalent of core::iter::Rev<core::slice::Iter<_>>
TryIntoArrayError
The error produced by trying to convert from &[T] to &[T; N], or from &mut [T] to &mut [T; N].
Windows
Const equivalent of core::slice::Windows
WindowsRev
Const equivalent of core::iter::Rev<core::slice::Windows>

Functions§

bytes_contain
Whether right is inside &left[from..].
bytes_end_with
A const equivalent of <[u8]>::ends_with
bytes_find
Finds the byte offset of right in left, starting from the from index.
bytes_find_keep
Advances this up to the first instance of needle.
bytes_find_skip
Advances this past the first instance of needle.
bytes_rcontain
Returns whether right is contained inside &left[..=from] searching in reverse.
bytes_rfind
Finds the byte offset of right inside &left[..=from], searching in reverse.
bytes_rfind_keep
Truncates this to the last instance of needle.
bytes_rfind_skip
Truncates this to before the last instance of needle.
bytes_start_with
A const equivalent of <[u8]>::starts_with
bytes_strip_prefix
A const equivalent of <[u8]>::strip_prefix
bytes_strip_suffix
A const equivalent of <[u8]>::strip_suffix
bytes_trim
Removes ascii whitespace from the start and end of this.
bytes_trim_end
Removes ascii whitespace from the end of this.
bytes_trim_end_matches
Removes all instances of needle from the end of this.
bytes_trim_matches
Removes all instances of needle from the start and end of this.
bytes_trim_start
Removes ascii whitespace from the start of this.
bytes_trim_start_matches
Removes all instances of needle from the start of this.
chunks
Const equivalent of <[T]>::chunks
chunks_exact
Const equivalent of <[T]>::chunks_exact
cmp_bytes
Compares two &[u8], returning the order of left relative to right.
cmp_option_bytes
Compares two Option<&'a [u8]>, returning the ordering of left relative to right.
eq_bytes
Compares two &[u8] for equality.
eq_option_bytes
Compares two Option<&'a [u8]> for equality.
first
A const equivalent of <[T]>::first
get
A const equivalent of slice.get(index)
get_from
A const equivalent of slice.get(start..).
get_range
A const equivalent of slice.get(start..end).
get_up_to
A const equivalent of slice.get(..len).
iter
Gets a const iterator over slice, const equivalent of <[T]>::iter
iter_copied
A const equivalent of slice.iter().copied()
last
A const equivalent of <[T]>::last
slice_from
A const equivalent of &slice[start..].
slice_range
A const equivalent of &slice[start..end].
slice_up_to
A const equivalent of &slice[..len].
split_at
A const equivalent of <[T]>::split_at
split_first
A const equivalent of <[T]>::split_first
split_last
A const equivalent of <[T]>::split_last
try_into_array
Tries to convert from &[T] to &[T; N], usable in const fns. Requires the "rust_1_56" feature.
windows
Const equivalent of <[T]>::windows