doc.rust-lang.org
pub const fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
...If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<'_, T, F>
slice::split_mut — Returns an iterator over mutable subslices separated by elements that match pred. The matched element is not contained in the subslices.
Examples
let mut v = [10, 40, 30, 20, 60, 50];
for group in v.split_mut(|num| *num % 3 == 0) {
group[0] = 1;
}
assert_eq!(v...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct SplitInclusive<'a, P>
SplitInclusive — An iterator over the substrings of a string, terminated by a substring matching to a predicate function Unlike Split, it contains the matched part as a terminator of the subslice.
This struct is created by the split_inclusive method on str. See its documentation for more.
struct
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn binary_search_by_key<'a, B, F>(&'a self, b: &B, f: F) -> Result<usize, usize>
...If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is...
method
core
Stable since 1.10.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct SplitInclusiveMut<'a, T, P>
SplitInclusiveMut — An 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.
This struct is created by the split_inclusive_mut method on slices.
Example
let mut v = [10, 40, 30...
struct
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn split_inclusive_mut<F>(&mut self, pred: F) -> SplitInclusiveMut<'_, T, F>
slice::split_inclusive_mut — Returns an iterator over mutable subslices separated by elements that match pred. The matched element is contained in the previous subslice as a terminator.
Examples
let mut v = [10, 40, 30, 20, 60, 50];
for group in v.split_inclusive_mut(|num| *num % 3 == 0) {
let...
method
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn binary_search(&self, x: &T) -> Result<usize, usize>
...If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. If the value is not found then Result::Err is returned, containing the index where a matching element could...
method
alloc
Stable since 1.54.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct SplitInclusive<'a, T, P>
SplitInclusive — An iterator over subslices separated by elements that match a predicate function. Unlike Split, it contains the matched part as a terminator of the subslice.
This struct is created by the split_inclusive method on slices.
Example
let slice = [10, 40, 33, 20];
let mut iter = slice.split_inclusive...
struct
core
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<'_, T, F>
slice::rsplit_mut — Returns an iterator over mutable subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.
Examples
let mut v = [100, 400, 300, 200, 600, 500];
let mut count = 0;
for group...
method
core
Stable since 1.27.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn splitn<F>(&self, n: usize, pred: F) -> SplitN<'_, T, F>
slice::splitn — 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.
The last element returned, if any, will contain the remainder of the slice.
Examples
Print the slice split once by numbers...
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>
slice::splitn_mut — 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.
The last element returned, if any, will contain the remainder of the slice.
Examples
let mut v = [10, 40...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn rmatches<P>(&self, pat: P) -> RMatches<'_, P>
str::rmatches — Returns an iterator over the disjoint matches of a pattern within this string slice, yielded in reverse order.
The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches.
Iterator behavior
The returned iterator requires that the...
method
core
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn rsplitn_mut<F>(&mut self, n: usize, pred: F) -> RSplitNMut<'_, T, F>
slice::rsplitn_mut — Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.
The last element returned, if any, will contain the...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn rsplitn<F>(&self, n: usize, pred: F) -> RSplitN<'_, T, F>
slice::rsplitn — Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.
The last element returned, if any, will contain the remainder...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn rfind<P>(&self, pat: P) -> Option<usize>
str::rfind — Returns the byte index for the first character of the last match of the pattern in this string slice.
Returns None if the pattern doesn't match.
The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn find<P>(&self, pat: P) -> Option<usize>
str::find — Returns the byte index of the first character of this string slice that matches the pattern.
Returns None if the pattern doesn't match.
The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches.
Examples
Simple...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains<P>(&self, pat: P) -> bool
str::contains — Returns true if the given pattern matches a sub-slice of this string slice.
Returns false if it does not.
The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches.
Examples
let bananas = "bananas";
assert!(bananas...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn ends_with<P>(&self, pat: P) -> bool
str::ends_with — Returns true if the given pattern matches a suffix of this string slice.
Returns false if it does not.
The pattern can be a &str, char, a slice of chars, or a function or closure that determines if a character matches.
Examples
let bananas = "bananas";
assert!(bananas...
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn eq_ignore_ascii_case(&self, other: &str) -> bool
str::eq_ignore_ascii_case — Checks that two strings are an ASCII case-insensitive match.
Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries.
For Unicode-aware case-insensitive matching, consider str::eq_ignore_case_unnormalized.
Examples
assert!("Ferris".eq_ignore_ascii_case...
method
core
Stable since 1.23.0
Version 1.100.0-nightly
doc.rust-lang.org
primitive i128
...i128 is intended to always match __int128 and does not attempt to match _BitInt(128) on platforms without __int128.
primitive
core
Stable since 1.26.0
Version 1.100.0-nightly