pub struct RwArc<T>(/* private fields */);Expand description
A reference-counting pointer with read-write capabilities.
This is essentially Arc<RwLock<T>>, so it can provide read-write capabilities through
RwArc::read and RwArc::write.
In addition, this allows to derive another reference-counting pointer with read-only
capabilities (RoArc) via RwArc::clone_ro.
The purpose of having this type is to allow lockless (read) access to the underlying data when
there is only one RwArc instance for the particular allocation (note that there can be any
number of RoArc instances for that allocation). See the [RwArc::get] method for more
details.
Implementations§
Source§impl<T> RwArc<T>
impl<T> RwArc<T>
Sourcepub exec fn read(&self) -> RwLockReadGuard<'_, T, PreemptDisabled>
pub exec fn read(&self) -> RwLockReadGuard<'_, T, PreemptDisabled>
Acquires the read lock for immutable access.
Sourcepub exec fn write(&self) -> RwLockWriteGuard<'_, T, PreemptDisabled>
pub exec fn write(&self) -> RwLockWriteGuard<'_, T, PreemptDisabled>
Acquires the write lock for mutable access.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RwArc<T>
impl<T> !RefUnwindSafe for RwArc<T>
impl<T> Send for RwArc<T>
impl<T> Sync for RwArc<T>
impl<T> Unpin for RwArc<T>
impl<T> !UnwindSafe for RwArc<T>
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