Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate rand; // 0.6.4
- extern crate fnv; // 1.0.6
- use rand::Rng;
- use std::sync::MutexGuard;
- struct B{
- }
- struct A<'a>(MutexGuard<'a, fnv::FnvHashMap<i32, String>>, MutexGuard<'a, fnv::FnvHashMap<String, B>>);
- impl A<'_>{
- fn f(&mut self, i: i32) -> Option<&mut B>{
- if let Some(l) = self.0.get(&i){
- if let Some(e) = self.1.get_mut(l){
- return Some(e);
- }
- }
- None
- }
- }
- fn main() {
- let mut a = A( unsafe{ std::mem::uninitialized() }, unsafe{ std::mem::uninitialized() } );
- let mut rng = rand::thread_rng();
- let e = a.f(rng.gen());
- let f = a.f(rng.gen());
- println!("Hello, world!");
- }
Add Comment
Please, Sign In to add comment