[][src]Struct simplelock::LockBuilder

pub struct LockBuilder { /* fields omitted */ }

Builds a lock from a ConcreteLock implementation using the configurations enabled. See below for all possible configurations. Note, by implementing the ConcreteLock implementation you can wrap it with a LockBuilder to create the Lock interface used in all utility functions.

Implementations

impl LockBuilder[src]

pub fn enable_silent_unlock(self)[src]

If the unlock fails, intermediate computation may be lost. This may not be the behaviour you wished for, so enable silent_unlock. You can then check the lock status afterwards by performing Lock::status.

pub fn enable_try_lock(self)[src]

If the lock is already taken, by default we would hang until it was our turn. By enabling 'try_lock' we instead try to lock but fail immediately with SimpleLockError::AlreadyLocked if we could not acquire it.

pub fn with_silent_unlock(self) -> Self[src]

Performs enable_status_unlock and then returns self so that we can chain additional configurations or a call to build.

pub fn with_try_lock(self) -> Self[src]

Performs enable_try_lock and then returns self so that we can chain additional configurations or a call to build.

pub fn wrap(
    &self,
    concrete: Box<dyn ConcreteLock>
) -> SimpleLockResult<Box<dyn Lock>>
[src]

Wraps a ConcreteLock with the configurations enabled with this LockBuilder and returns the simplified Lock interface.

pub fn build(
    &self,
    app_name: impl Into<String>
) -> SimpleLockResult<Box<dyn Lock>>
[src]

Create a Lock based on the configurations enabled using the implementation enabled in the Cargo.toml. For example, if the "file" feature is enabled a FileLock will be produced from this build call.

Trait Implementations

impl Clone for LockBuilder[src]

impl Copy for LockBuilder[src]

impl Debug for LockBuilder[src]

impl Default for LockBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,