pub struct RwLock<T> { /* private fields */ }
Expand description
Wrapper for std::sync::RwLock
.
Implementations§
Source§impl<T> RwLock<T>
impl<T> RwLock<T>
pub const fn new(t: T) -> Self
Sourcepub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>>
pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>>
Wrapper for std::sync::RwLock::read
.
§Panics
This method participates in lock dependency tracking. If acquiring this lock introduces a dependency cycle, this method will panic.
Sourcepub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>>
pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>>
Wrapper for std::sync::RwLock::write
.
§Panics
This method participates in lock dependency tracking. If acquiring this lock introduces a dependency cycle, this method will panic.
Sourcepub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>>
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>>
Wrapper for std::sync::RwLock::try_read
.
§Panics
This method participates in lock dependency tracking. If acquiring this lock introduces a dependency cycle, this method will panic.
Sourcepub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>>
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>>
Wrapper for std::sync::RwLock::try_write
.
§Panics
This method participates in lock dependency tracking. If acquiring this lock introduces a dependency cycle, this method will panic.
Sourcepub fn get_mut(&mut self) -> LockResult<&mut T>
pub fn get_mut(&mut self) -> LockResult<&mut T>
Return a mutable reference to the underlying data.
This method does not block as the locking is handled compile-time by the type system.
Sourcepub fn into_inner(self) -> LockResult<T>
pub fn into_inner(self) -> LockResult<T>
Unwrap the mutex and return its inner value.