Module slice

Source
Expand description

const fn equivalents of slice methods.

§Removed in 0.3.0

These functions were removed in 0.3.0 because there is an equivalent const fn in the standard library:

  • first
  • last
  • split_first
  • split_last

Macros§

slice_concat
Macro equivalent of <[&[T]]>::concat, which takes a constant as an argument.

Structs§

TryIntoArrayError
The error produced by trying to convert from &[T] to &[T; N], or from &mut [T] to &mut [T; N].

Traits§

BytesPattern
A byte slice pattern.

Functions§

as_chunks
Const equivalent of <[T]>::as_chunks
as_rchunks
Const equivalent of <[T]>::as_rchunks
bytes_contain
Whether pattern is inside left.
bytes_end_with
Whether pattern is the end of left.
bytes_find
Finds the byte offset of pattern in left.
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 pattern is contained inside left, searching in reverse.
bytes_rfind
Finds the byte offset of pattern inside left, 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
Whether pattern is the start of left.
bytes_strip_prefix
Remove prefix from the start of left.
bytes_strip_suffix
Remove suffix from the end of left.
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.
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.
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).
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
try_into_array
Tries to convert from &[T] to &[T; N].