pub struct RcuOptionBox<T: Send + Sync + 'static> { /* private fields */ }Expand description
An RCU (Read-Copy-Update) wrapper around Option<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 for some period of time.
Implementations§
Source§impl<T: Send + Sync + 'static> RcuOptionBox<T>
impl<T: Send + Sync + 'static> RcuOptionBox<T>
Sourcepub fn read(&self) -> Option<RcuReadGuard<T>>
pub fn read(&self) -> Option<RcuReadGuard<T>>
Read the value of the wrapped Box, if present.
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) -> Option<&'a T>
pub fn as_ref<'a>(&self, scope: &'a RcuReadScope) -> Option<&'a T>
Returns a reference to the value of the wrapped Box, if present.
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 RcuOptionBox<T>
impl<T> RefUnwindSafe for RcuOptionBox<T>
impl<T> Send for RcuOptionBox<T>
impl<T> Sync for RcuOptionBox<T>
impl<T> Unpin for RcuOptionBox<T>
impl<T> UnsafeUnpin for RcuOptionBox<T>
impl<T> UnwindSafe for RcuOptionBox<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