Guest User

Untitled

a guest
Oct 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. use std::sync::{Mutex, MutexGuard};
  2.  
  3. trait Lock<'a, GUARD: 'a> {
  4. fn lock(&'a self) -> GUARD;
  5. }
  6.  
  7. impl<'a, T> Lock<'a, MutexGuard<'a, T>> for Mutex<T> {
  8. fn lock(&'a self) -> MutexGuard<'a, T> {
  9. self.lock().unwrap()
  10. }
  11. }
Add Comment
Please, Sign In to add comment