rustordby_key

Provides a convenient macro for implementing Ord trait with logic specified in an inline expression

``rust use core::cmp::Reverse; //Personwill be ordered bylastname, then byfirstname, then byage` in reverse

[ordeqbykeyselector(|p|

&p.last_name,
&p.first_name,
Reverse(p.age),)]

pub struct Person { pub firstname: String, pub lastname: String, pub age: usize, } ```

``rust // Container for&str` which will be ordered by underlying string length

[ordeqbykeyselector(|s| s.0.len())]

pub struct StrByLen<'a> (&'a str);

assert!(StrByLen("Alex") > StrByLen("Bob")) ```

License

Distributed under the terms of both the MIT license and the Apache License (Version 2.0)