Struct loom::sync::RwLock [−][src]
Mock implementatoin of std::sync::RwLock
Implementations
impl<T> RwLock<T>
[src]
pub fn new(data: T) -> RwLock<T>
[src]
Creates a new rwlock in an unlocked state ready for use.
pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>>
[src]
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.
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>>
[src]
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.
pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>>
[src]
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.
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>>
[src]
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.
pub fn into_inner(self) -> LockResult<T>
[src]
Consumes this RwLock
, returning the underlying data.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for RwLock<T>
impl<T> Send for RwLock<T> where
T: Send,
T: Send,
impl<T> Sync for RwLock<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Unpin for RwLock<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for RwLock<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,