Guest User

Untitled

a guest
Feb 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. extern crate rand; // 0.6.4
  2.  
  3. use std::collections::HashMap;
  4. use rand::Rng;
  5. use std::sync::MutexGuard;
  6.  
  7.  
  8.  
  9.  
  10. struct A<'a>(MutexGuard<'a, HashMap<i32, String>>, MutexGuard<'a, HashMap<String, Vec<u32>>>);
  11.  
  12. impl A<'_>{
  13. fn f(&mut self, i: i32) -> Option<&mut Vec<u32>>{
  14. if let Some(l) = self.0.get(&i){
  15. if let Some(e) = self.1.get_mut(l){
  16. return Some(e);
  17. }
  18. }
  19.  
  20. None
  21. }
  22. }
  23.  
  24.  
  25.  
  26. fn main() {
  27. let mut a = A( unsafe{ std::mem::uninitialized() }, unsafe{ std::mem::uninitialized() } );
  28.  
  29. let mut rng = rand::thread_rng();
  30.  
  31. let e = a.f(rng.gen());
  32.  
  33. let f = a.f(rng.gen());
  34.  
  35. println!("Hello, world!");
  36. }
Add Comment
Please, Sign In to add comment