slice
pub fn slice#T:Ord(a &mut []T)Purpose
In-place sort using Ord.less.
Parameters
a&mut []T- slice to operate on (exclusive borrow; type &mut []T)
API
#sortints/f64s/strings introsort; slice / slice_func by Ord or callback.
slicepub fn slice#T:Ord(a &mut []T)In-place sort using Ord.less.
a &mut []Tintspub fn ints(a &mut []int)In-place ascending sort.
a &mut []intstringspub fn strings(a &mut []string)In-place ascending sort.
a &mut []stringf64spub fn f64s(a &mut []f64)In-place ascending sort.
a &mut []f64slice_funcpub fn slice_func#T(a &mut []T, less fn(T, T) bool)Small integer ranges and f64s use introsort. Generic `slice_func` keeps the original
a &mut []Tless fn(T, T) boolstruct Searchpub struct Search {
pub index int
pub found bool
}Public struct `Search`.
index intfound boollookup_intspub fn lookup_ints(a &[]int, v int) SearchLookup int slice.
a &[]intv intSearch — a value of this type
lookup_stringspub fn lookup_strings(a &[]string, v string) SearchLookup string slice.
a &[]stringv stringSearch — a value of this type
lookup_f64spub fn lookup_f64s(a &[]f64, v f64) SearchLookup f64 slice.
a &[]f64v f64Search — a value of this type
search_intspub fn search_ints(a &[]int, v int) intBinary search a sorted slice.
a &[]intv intint — index in the sorted slice (insertion point if missing)
search_stringspub fn search_strings(a &[]string, v string) intBinary search a sorted slice.
a &[]stringv stringint — index in the sorted slice (insertion point if missing)
search_f64spub fn search_f64s(a &[]f64, v f64) intBinary search a sorted slice.
a &[]f64v f64int — index in the sorted slice (insertion point if missing)
is_sorted_intspub fn is_sorted_ints(a &[]int) boolWhether the slice is sorted ascending.
a &[]intbool — true or false
is_sorted_stringspub fn is_sorted_strings(a &[]string) boolWhether the slice is sorted ascending.
a &[]stringbool — true or false
is_sorted_f64spub fn is_sorted_f64s(a &[]f64) boolWhether the slice is sorted ascending.
a &[]f64bool — true or false
reverse_intspub fn reverse_ints(a &mut []int)In-place descending sort (sort ascending, then reverse).
a &mut []intreverse_stringspub fn reverse_strings(a &mut []string)In-place descending sort (sort ascending, then reverse).
a &mut []stringreverse_f64spub fn reverse_f64s(a &mut []f64)In-place descending sort (sort ascending, then reverse).
a &mut []f64