pub struct SelectSort<T> { /* private fields */ }
Expand description

select sort

Implementations§

Examples found in repository?
src/sort/select_sort.rs (line 75)
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)
    }
Examples found in repository?
src/sort/select_sort.rs (line 44)
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
    }

Trait Implementations§

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

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
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.

Should always be Self
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.