daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Mar 18th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::collections::HashMap;
  2. use std::sync::Arc;
  3.  
  4. #[derive(PartialEq, Eq, Hash, Debug)]
  5. struct V {}
  6.  
  7. fn main() {
  8.     let v1 = V {};
  9.     let v2 = V {};
  10.    
  11.     let mut collect = HashMap::<&Arc<V>, usize>::new();
  12.    
  13.     let av1 = Arc::new(v1);
  14.     let av2 = Arc::new(v2);
  15.    
  16.     collect.insert(&av1, 15);
  17.     collect.insert(&av2, 42);
  18.    
  19.     println!("{:?}", collect.get(&av1));
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top