Guest User

Untitled

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