pub struct RwLock<T: ?Sized>(/* private fields */);
Expand description
Provides interior mutability.
It’s tailored for internal use in egui should only be used for short locks (as a guideline, locks should never be held longer than a single frame). In debug builds, when a lock can’t be acquired within 10 seconds, we assume a deadlock and will panic.
This is a thin wrapper around parking_lot::RwLock
.
Implementations§
Source§impl<T: ?Sized> RwLock<T>
impl<T: ?Sized> RwLock<T>
Sourcepub fn read(&self) -> RwLockReadGuard<'_, T>
pub fn read(&self) -> RwLockReadGuard<'_, T>
Try to acquire read-access to the lock.
§Panics
Will panic in debug builds if the lock can’t be acquired within 10 seconds.
Sourcepub fn write(&self) -> RwLockWriteGuard<'_, T>
pub fn write(&self) -> RwLockWriteGuard<'_, T>
Try to acquire write-access to the lock.
§Panics
Will panic in debug builds if the lock can’t be acquired within 10 seconds.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for RwLock<T>
impl<T> !RefUnwindSafe for RwLock<T>
impl<T> Send for RwLock<T>
impl<T> Sync for RwLock<T>
impl<T> Unpin for RwLock<T>
impl<T> UnwindSafe for RwLock<T>where
T: UnwindSafe + ?Sized,
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