Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- use std::hash::Hash;
- trait Storable: Eq + Hash {
- fn do_nothing(&self) {}
- }
- #[derive(Debug, PartialEq, Eq, Hash)]
- struct ThingA {}
- #[derive(Debug, PartialEq, Eq, Hash)]
- struct ThingB {}
- impl Storable for ThingA {}
- fn main() {
- let thing_a = ThingA{};
- let thing_b = ThingB{};
- let who_knows: &Storable = &thing_a;
- let no_work: Box<Storable> = Box::new(ThingA{});
- let db: HashMap<Box<Storable>, bool> = HashMap::new();
- }
Add Comment
Please, Sign In to add comment