pub fn map<U: ?Sized, F>(this: Self, cb: F) -> MutexGuard<'mutex, U>
        where F: FnOnce(&'mutex mut T) -> &'mutex mut U
    {
        match MutexGuard::filter_map(this, move |x| Ok::<_, ()>(cb(x))) {
            Ok(guard) => guard,
            Err(_) => unreachable!()
        }
    }
/// Transform this guard to hold a sub-borrow of the original data.
///
/// Applies the supplied closure to the data, returning a new lock
/// guard referencing the borrow returned by the closure.
///
/// # Examples
///
/// ```rust
/// # use rwlock2::{Mutex, MutexGuard};
/// let x = Mutex::new(vec![1, 2]);
///
/// {
///     let mut y = MutexGuard::map(x.lock().unwrap(), |v| &mut v[0]);
///     *y = 3;
/// }
///
/// assert_eq!(&*x.lock().unwrap(), &[3, 2]);
/// ```
Transform this guard to hold a sub-borrow of the original data.
Applies the supplied closure to the data, returning a new lock
guard referencing the borrow returned by the closure.
Transform this guard to hold a sub - borrow of the original data . Applies the supplied closure to the data returning a new lock guard referencing the borrow returned by the closure .
pub fn map<U: ?Sized, F>(this: Self, cb: F) -> MutexGuard<'mutex, U>
        where F: FnOnce(&'mutex mut T) -> &'mutex mut U
    {
        match MutexGuard::filter_map(this, move |x| Ok::<_, ()>(cb(x))) {
            Ok(guard) => guard,
            Err(_) => unreachable!()
        }
    }
pub fn map < U : ? Sized , F > ( this : Self , cb : F ) -> MutexGuard < ' mutex , U > where F : FnOnce ( & ' mutex mut T ) -> & ' mutex mut U { match MutexGuard :: filter_map ( this , move | x | Ok :: < _ , ( ) > ( cb ( x ) ) ) { Ok ( guard ) => guard , Err ( _ ) => unreachable ! ( ) } }
Transform this guard to hold a sub-borrow of the original data.
Transform this guard to hold a sub - borrow of the original data .
this
Self
cb
F
this
Self
cb
F
examples
None
use rwlock2::{mutex, mutexguard};
None