Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #[derive(Debug)]
  2. enum SomeEnum {
  3. A,
  4. B,
  5. }
  6.  
  7. fn main() {
  8. let vector = vec!(("Foo", SomeEnum::A), ("Bar", SomeEnum::B),("Foo", SomeEnum::B), ("Foo", SomeEnum::A));
  9.  
  10. // I would here like to be able to sort/sort_by leaving this
  11. // it is sorted by tuple.0 and tuple.1 first looking at tuple.0 then tuple.1
  12. // [("Bar", SomeEnum::B), ("Foo", SomeEnum::A), ("Foo", SomeEnum::B), ("Foo", SomeEnum::B)]
  13.  
  14. // Then I would like to dedup the list leaving this:
  15. // [("Bar", SomeEnum::B), ("Foo", SomeEnum::A), ("Foo", SomeEnum::B)]
  16.  
  17. println!("{:?}", vector)
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement