Sorting

Derive Macro Sorting 

Source
#[derive(Sorting)]
{
    // Attributes available to this derive:
    #[sorting]
}
Expand description

Sorting for structures

Automatically implements Eq, PartialEq, Ord and PartialOrd for single-field comparison, supports structures with no or a single lifetime.

The default sorting field is “id”, can be overriden with sorting(id = “field”) attribute:

§Panics

Will panic on invalid attributes and if the expression is not a struct

use bmart_derive::Sorting;

#[derive(Sorting)]
#[sorting(id = "name")]
struct MyStruct {
    name: String,
    value: u32
}