Struct ruspiro_lock::sync::RWLock[][src]

#[repr(C, align(16))]
pub struct RWLock<T: ?Sized> { /* fields omitted */ }
Expand description

An exclusive access lock around the given data

Implementations

Create a new data access guarding lock.

Try to provide a Writelock for mutual exclusive access. Returns None if the lock fails or Some(WriteLockGuard). The actual data, the WriteLockGuard wraps could be conviniently accessed by dereferencing it.

Provide a WriteLock for mutual exclusive access. This blocks until the data could be successfully locked. This also implies that there is no concurrent ReadLockGuard existing. The locked data will be returned as WriteLockGuard. Simply derefrencing this allows access to the contained data value.

Provide a ReadLock to the wrapped data. This call blocks until the recource is available. There can be as many concurrent ReadLockGuards being handed out if there is no WriteLockGuard to the same resource already existing.

Provide a ReadLock to the wrapped data. This call blocks until the recource is available. There can be as many concurrent ReadLockGuards being handed out if there is no WriteLockGuard to the same resource already existing.

Provide an immutable borrow to the data secured by the RWLock.

Safety

This is only safe if it is guarantied that there is exactly only one call to this function or any other accessor of the RWLock until the returned borrow goes out of scope.

Consume the Mutex and return the inner value

Trait Implementations

Formats the value using the given formatter. Read more

The RWLock is always Sync, to make it Send as well it need to be wrapped into an Arc.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.