pub trait SortableData<T: TotalCmp + Clone>: Data<T> + Sync {
// Provided methods
fn as_contiguous_slice(&self) -> Option<&[T]> { ... }
fn argsort_unstable(&self, pool: Option<&ThreadPool>) -> Vec<usize> { ... }
}Expand description
Marker trait: implementors of Data<T> that also support sorting.
The default argsort_unstable uses get_at for element access so no
copy is needed regardless of memory layout. Implementors that can provide
a contiguous &[T] should override as_contiguous_slice to enable a
faster slice-based comparator that LLVM can optimize more aggressively.
Provided Methods§
Sourcefn as_contiguous_slice(&self) -> Option<&[T]>
fn as_contiguous_slice(&self) -> Option<&[T]>
Return a contiguous slice if the data is laid out contiguously in
memory, None otherwise. The default returns None.
fn argsort_unstable(&self, pool: Option<&ThreadPool>) -> Vec<usize>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".