doc.rust-lang.org
pub fn subslice_range(&self, subslice: &[T]) -> Option<core::range::Range<usize>>
Returns the range of indices that a subslice points to.
method
core
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn strip_suffix<P>(&self, suffix: &P) -> Option<&[T]>
Returns a subslice with the suffix removed.
method
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn strip_prefix<P>(&self, prefix: &P) -> Option<&[T]>
Returns a subslice with the prefix removed.
method
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn strip_circumfix<S, P>(&self, prefix: &P, suffix: &S) -> Option<&[T]>
Returns a subslice with the prefix and suffix removed.
method
core
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn starts_with(&self, needle: &[T]) -> bool
Returns true if needle is a prefix of the slice or equal to the slice.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<'_, T, F>
Returns an iterator over mutable subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn splitn<F>(&self, n: usize, pred: F) -> SplitN<'_, T, F>
Returns an iterator over subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_off_mut<'a, R>(self: &mut &'a mut Self, range: R) -> Option<&'a mut Self>
Removes the subslice corresponding to the given range and returns a mutable reference to it.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_off_last_mut<'a>(self: &mut &'a mut Self) -> Option<&'a mut T>
Removes the last element of the slice and returns a mutable reference to it.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_off_last<'a>(self: &mut &'a Self) -> Option<&'a T>
Removes the last element of the slice and returns a reference to it.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_off_first_mut<'a>(self: &mut &'a mut Self) -> Option<&'a mut T>
Removes the first element of the slice and returns a mutable reference to it.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_off_first<'a>(self: &mut &'a Self) -> Option<&'a T>
Removes the first element of the slice and returns a reference to it.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_off<'a, R>(self: &mut &'a Self, range: R) -> Option<&'a Self>
Removes the subslice corresponding to the given range and returns a reference to it.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<'_, T, F>
Returns an iterator over mutable subslices separated by elements that match pred. The matched element is not contained in the subslices.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])>
Returns the last and all the rest of the elements of the slice, or None if it is empty.
method
core
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_last_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T], &mut [T; N])>
Returns a mutable array reference to the last N items in the slice and the remaining slice.
method
core
Stable since 1.77.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_last_chunk<const N: usize>(&self) -> Option<(&[T], &[T; N])>
Returns an array reference to the last N items in the slice and the remaining slice.
method
core
Stable since 1.77.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn split_last(&self) -> Option<(&T, &[T])>
Returns the last and all the rest of the elements of the slice, or None if it is empty.
method
core
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_inclusive_mut<F>(&mut self, pred: F) -> SplitInclusiveMut<'_, T, F>
Returns an iterator over mutable subslices separated by elements that match pred. The matched element is contained in the previous subslice as a terminator.
method
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_inclusive<F>(&self, pred: F) -> SplitInclusive<'_, T, F>
Returns an iterator over subslices separated by elements that match pred. The matched element is contained in the end of the previous subslice as a terminator.
method
core
Stable since 1.51.0
Version 1.100.0-nightly