Guest User

Untitled

a guest
Jun 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. use std::collections::HashMap;
  2. use std::hash::Hash;
  3.  
  4.  
  5. trait Storable: Eq + Hash {
  6. fn do_nothing(&self) {}
  7. }
  8.  
  9. #[derive(Debug, PartialEq, Eq, Hash)]
  10. struct ThingA {}
  11. #[derive(Debug, PartialEq, Eq, Hash)]
  12. struct ThingB {}
  13.  
  14. impl Storable for ThingA {}
  15.  
  16. fn main() {
  17.  
  18. let thing_a = ThingA{};
  19. let thing_b = ThingB{};
  20.  
  21. let who_knows: &Storable = &thing_a;
  22. let no_work: Box<Storable> = Box::new(ThingA{});
  23.  
  24. let db: HashMap<Box<Storable>, bool> = HashMap::new();
  25.  
  26. }
Add Comment
Please, Sign In to add comment