pub fn with<A, B>(&mut self, a: A) -> Result<B, SemalockError>
    where
        A: FnOnce(&mut Self) -> B,
    {
        self.acquire().and_then(|_| {
            let result = a(self);

            self.release().map(|_| result)
        })
    }
/// Acquires the lock, runs the provided function, and releases the lock. If the provided
/// function panics, the lock is not automatically released. In this case, the secondary
/// level of exclusive file locks will take effect, temporarily affecting performance
/// until a timeout occurs and normal behavior is restored (in other applications).
Acquires the lock, runs the provided function, and releases the lock. If the provided
function panics, the lock is not automatically released. In this case, the secondary
level of exclusive file locks will take effect, temporarily affecting performance
until a timeout occurs and normal behavior is restored (in other applications).
Acquires the lock runs the provided function and releases the lock . If the provided function panics the lock is not automatically released . In this case the secondary level of exclusive file locks will take effect temporarily affecting performance until a timeout occurs and normal behavior is restored ( in other applications ) .
pub fn with<A, B>(&mut self, a: A) -> Result<B, SemalockError>
    where
        A: FnOnce(&mut Self) -> B,
    {
        self.acquire().and_then(|_| {
            let result = a(self);
            self.release().map(|_| result)
        })
    }
pub fn with < A , B > ( & mut self , a : A ) -> Result < B , SemalockError > where A : FnOnce ( & mut Self ) -> B , { self . acquire ( ) . and_then ( | _ | { let result = a ( self ) ; self . release ( ) . map ( | _ | result ) } ) }
Acquires the lock, runs the provided function, and releases the lock.
Acquires the lock runs the provided function and releases the lock .
&mut self
a
A