pub struct RwLock<T> { /* private fields */ }Expand description
Implementations§
Source§impl<T> RwLock<T>
impl<T> RwLock<T>
Sourcepub fn read(&self) -> RwLockFuture<'_, T, RwLockReadGuard<'_, T>> ⓘ
pub fn read(&self) -> RwLockFuture<'_, T, RwLockReadGuard<'_, T>> ⓘ
Block until the wrapped value can be immutably borrowed
Sourcepub fn try_read(&self) -> Option<RwLockReadGuard<'_, T>>
pub fn try_read(&self) -> Option<RwLockReadGuard<'_, T>>
Attempt to immutably borrow the wrapped value.
Returns None if the value is currently mutably borrowed or a task is waiting on a mutable reference.
Sourcepub fn write(&self) -> RwLockFuture<'_, T, RwLockWriteGuard<'_, T>> ⓘ
pub fn write(&self) -> RwLockFuture<'_, T, RwLockWriteGuard<'_, T>> ⓘ
Block until the wrapped value can be mutably borrowed
Sourcepub fn try_write(&self) -> Option<RwLockWriteGuard<'_, T>>
pub fn try_write(&self) -> Option<RwLockWriteGuard<'_, T>>
Attempt to mutably borrow the wrapped value.
Returns None if the value is already borrowed (mutably or immutably)
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes this RwLock and returns ownership of the wrapped value
Sourcepub fn into_inner_rc(self: Rc<Self>) -> T
pub fn into_inner_rc(self: Rc<Self>) -> T
Convenience method to consume Rc<RwLock<T>> and return the wrapped value
§Panics
This method panics if the Rc has more than one strong reference