pub struct SelectSort<T> { /* private fields */ }
Expand description
71
72
73
74
75
76
fn sort_by<F>(&mut self, f: F)
where
F: FnOnce(&T, &T) -> bool + core::marker::Copy,
{
self.select_sort(f)
}
38
39
40
41
42
43
44
45
46
47
48
pub fn select_sort_by_find_smallest<F>(&mut self, f: F) -> Vec<T>
where
F: FnOnce(Option<&T>, Option<&T>) -> bool + core::marker::Copy,
{
let mut result = vec![];
for _ in 0..self.arr.len() {
let smallest = self.find_smallest(f);
result.push(self.arr.swap_remove(smallest));
}
result
}
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Get the internal data
Customizable comparison logic based on closures
Sort by ascending order
Determine if the sort is ascending
Customized judgments are ordered
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.