pub trait IntoSorted<Item>: IsArray<Item> {
// Required methods
fn into_sorted(self) -> Self
where Item: Ord;
fn into_sorted_by<Order>(self, order: Order) -> Self
where Order: FnMut(&Item, &Item) -> Ordering;
fn into_sorted_by_key<Key, GetKey>(self, get_key: GetKey) -> Self
where GetKey: FnMut(&Item) -> Key,
Key: Ord;
fn into_sorted_by_cached_key<Key, GetKey>(self, get_key: GetKey) -> Self
where GetKey: FnMut(&Item) -> Key,
Key: Ord;
}
Expand description
Utility methods to sort various types of arrays with a stable algorithm (requires allocation).
Required Methods§
Sourcefn into_sorted(self) -> Selfwhere
Item: Ord,
fn into_sorted(self) -> Selfwhere
Item: Ord,
Sort an array by Ord
and return it.
This function calls slice::sort
under the hook.
Sourcefn into_sorted_by<Order>(self, order: Order) -> Self
fn into_sorted_by<Order>(self, order: Order) -> Self
Sort an array by a function and return it.
This function calls slice::sort_by
under the hook.
Sourcefn into_sorted_by_key<Key, GetKey>(self, get_key: GetKey) -> Self
fn into_sorted_by_key<Key, GetKey>(self, get_key: GetKey) -> Self
Sort an array by a key extraction function and return it.
This function calls slice::sort_by_key
under the hook.
Sourcefn into_sorted_by_cached_key<Key, GetKey>(self, get_key: GetKey) -> Self
fn into_sorted_by_cached_key<Key, GetKey>(self, get_key: GetKey) -> Self
Sort an array by a key extraction function and return it.
This function calls slice::sort_by_cached_key
under the hook.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.