pub struct RwLock<T> { /* private fields */ }
Expand description

Mock implementation of std::sync::RwLock

Implementations

Creates a new rwlock in an unlocked state ready for use.

Locks this rwlock with shared read access, blocking the current thread until it can be acquired.

The calling thread will be blocked until there are no more writers which hold the lock. There may be other readers currently inside the lock when this method returns. This method does not provide any guarantees with respect to the ordering of whether contentious readers or writers will acquire the lock first.

Attempts to acquire this rwlock with shared read access.

If the access could not be granted at this time, then Err is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

This function does not block.

Locks this rwlock with exclusive write access, blocking the current thread until it can be acquired.

This function will not return while other writers or other readers currently have access to the lock.

Attempts to lock this rwlock with exclusive write access.

If the lock could not be acquired at this time, then Err is returned. Otherwise, an RAII guard is returned which will release the lock when it is dropped.

This function does not block.

Consumes this RwLock, returning the underlying data.

Trait Implementations

Formats the value using the given formatter. Read more

Creates a RwLock<T>, with the Default value for T.

Creates a new rwlock in an unlocked state ready for use. This is equivalent to RwLock::new.

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

Converts to this type from the input type.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more