pub struct RcuBox<T: Send + Sync + 'static> { /* private fields */ }Expand description
An RCU (Read-Copy-Update) wrapper around a Box.
The Box can be dereferenced from multiple threads concurrently without blocking. When the Box is replaced, reads may continue to see the old Box pointer for some period of time.
Implementations§
Source§impl<T: Send + Sync + 'static> RcuBox<T>
impl<T: Send + Sync + 'static> RcuBox<T>
Sourcepub fn read(&self) -> RcuReadGuard<T>
pub fn read(&self) -> RcuReadGuard<T>
Read the value of the wrapped Box.
The object referenced by the Box will remain valid until the RcuReadGuard is dropped.
However, another thread running concurrently might see a different object.
Sourcepub fn as_ref<'a>(&self, scope: &'a RcuReadScope) -> &'a T
pub fn as_ref<'a>(&self, scope: &'a RcuReadScope) -> &'a T
Returns a reference to the value of the wrapped Box.
The object referenced by the Box will remain valid until the RcuReadScope is dropped.
However, another thread running concurrently might see a different object.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for RcuBox<T>
impl<T> RefUnwindSafe for RcuBox<T>
impl<T> Send for RcuBox<T>
impl<T> Sync for RcuBox<T>
impl<T> Unpin for RcuBox<T>
impl<T> UnsafeUnpin for RcuBox<T>
impl<T> UnwindSafe for RcuBox<T>where
T: RefUnwindSafe,
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