pub async fn map<F, U>(&self, mapper: F) -> Result<U, TimeoutError>
    where
        F: FnOnce(&T) -> U,
    {
        match self.lock.read() {
            Ok(v) => {
                timeout(std::time::Duration::from_secs(1), async {
                    mapper(&v.value)
                })
                .await
            }
            Err(_) => panic!("Slock could not read for map!"),
        }
    }
/// Extract inner values from within a Slock
/// ```rust
/// # use slock::*;
/// # struct User { name: &'static str };
/// # let lock = Slock::new(User {name: "bobs"});
/// # async {
/// let name = lock.map(|v| v.name).await;
/// # };
/// ```
Extract inner values from within a Slock
```rust
Extract inner values from within a Slock ` ` ` rust
pub async fn map<F, U>(&self, mapper: F) -> Result<U, TimeoutError>
    where
        F: FnOnce(&T) -> U,
    {
        match self.lock.read() {
            Ok(v) => {
                timeout(std::time::Duration::from_secs(1), async {
                    mapper(&v.value)
                })
                .await
            }
            Err(_) => panic!("Slock could not read for map!"),
        }
    }
pub async fn map < F , U > ( & self , mapper : F ) -> Result < U , TimeoutError > where F : FnOnce ( & T ) -> U , { match self . lock . read ( ) { Ok ( v ) => { timeout ( std :: time :: Duration :: from_secs ( 1 ) , async { mapper ( & v . value ) } ) . await } Err ( _ ) => panic ! ( " " ) , } }
Extract inner values from within a Slock
```rust
Extract inner values from within a Slock ` ` ` rust
&self
mapper
F
&self
mapper
F
use slock::*;
None
struct user { name: &'static str };
None
let lock = slock::new(user {name: "bobs"});
None
async {
let name = lock.map(|v| v.name).await.
let name = lock . map ( |v| v . name ) . await .
};
None