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
Auto Trait Implementations§
impl<T> !Freeze for RwLock<T>
impl<T> !RefUnwindSafe for RwLock<T>
impl<T> Send for RwLock<T>where
T: Send,
impl<T> !Sync for RwLock<T>
impl<T> Unpin for RwLock<T>where
T: Unpin,
impl<T> UnwindSafe for RwLock<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more