into_sorted/stable/
functions.rs1use core::cmp::Ordering;
2
3#[inline]
5pub fn into_sorted<Item, Array>(mut array: Array) -> Array
6where
7 Array: AsMut<[Item]>,
8 Item: Ord,
9{
10 array.as_mut().sort();
11 array
12}
13
14#[inline]
16pub fn into_sorted_by<Item, Array, Order>(mut array: Array, order: Order) -> Array
17where
18 Array: AsMut<[Item]>,
19 Order: FnMut(&Item, &Item) -> Ordering,
20{
21 array.as_mut().sort_by(order);
22 array
23}
24
25#[inline]
27pub fn into_sorted_by_key<Item, Array, Key, GetKey>(mut array: Array, get_key: GetKey) -> Array
28where
29 Array: AsMut<[Item]>,
30 GetKey: FnMut(&Item) -> Key,
31 Key: Ord,
32{
33 array.as_mut().sort_by_key(get_key);
34 array
35}
36
37#[inline]
39pub fn into_sorted_by_cached_key<Item, Array, Key, GetKey>(
40 mut array: Array,
41 get_key: GetKey,
42) -> Array
43where
44 Array: AsMut<[Item]>,
45 GetKey: FnMut(&Item) -> Key,
46 Key: Ord,
47{
48 array.as_mut().sort_by_cached_key(get_key);
49 array
50}