Trait lib_word_count::pivot_sort::Sortable [-] [+] [src]

pub trait Sortable {
    fn weight(&self) -> i64;
}

Trait to mark a sortable implementation.

Intended for use with pivot_sort_high_to_low

Examples

use lib_word_count::pivot_sort::Sortable;

struct Something {
    x: i64,
}

impl Sortable for Something {
    fn weight(&self) -> i64 {
        self.x
    }
}

let something = Something{
    x: 2
};

assert_eq!(something.weight(), 2i64);

Required Methods

fn weight(&self) -> i64

The value to sort by.

Implementors