[−][src]Struct left_right::WriteHandle
A writer handle to a left-right guarded data structure.
All operations on the underlying data should be enqueued as operations of type O
using
append
. The effect of this operations are only exposed to readers once
publish
is called.
Reading through a WriteHandle
WriteHandle
allows access to a ReadHandle
through Deref<Target = ReadHandle>
. Note that
since the reads go through a ReadHandle
, those reads are subject to the same visibility
restrictions as reads that do not go through the WriteHandle
: they only see the effects of
operations prior to the last call to publish
.
Implementations
impl<T, O> WriteHandle<T, O> where
T: Absorb<O>,
[src]
T: Absorb<O>,
pub fn publish(&mut self) -> &mut Self
[src]
Publish all operations append to the log to reads.
This method needs to wait for all readers to move to the "other" copy of the data so that it can replay the operational log onto the stale copy the readers used to use. This can take some time, especially if readers are executing slow operations, or if there are many of them.
pub fn has_pending_operations(&self) -> bool
[src]
Returns true if there are operations in the operational log that have not yet been exposed to readers.
pub fn append(&mut self, op: O) -> &mut Self
[src]
Append the given operation to the operational log.
Its effects will not be exposed to readers until you call publish
.
pub fn raw_write_handle(&mut self) -> NonNull<T>
[src]
Returns a raw pointer to the write copy of the data (the one readers are not accessing).
Note that it is only safe to mutate through this pointer if you know that there are no
readers still present in this copy. This is not normally something you know; even after
calling publish
, readers may still be in the write copy for some time. In general, the
only time you know this is okay is before the first call to publish
(since no readers
ever entered the write copy).
Methods from Deref<Target = ReadHandle<T>>
pub fn enter(&self) -> Option<ReadGuard<'_, T>>
[src]
Take out a guarded live reference to the read copy of the T
.
While the guard lives, the WriteHandle
cannot proceed with a call to
WriteHandle::publish
, so no queued operations will become visible to any reader.
If the WriteHandle
has been dropped, this function returns None
.
pub fn was_dropped(&self) -> bool
[src]
Returns true if the WriteHandle
has been dropped.
Trait Implementations
impl<T, O> Debug for WriteHandle<T, O> where
T: Absorb<O> + Debug,
O: Debug,
[src]
T: Absorb<O> + Debug,
O: Debug,
impl<T, O> Deref for WriteHandle<T, O> where
T: Absorb<O>,
[src]
T: Absorb<O>,
type Target = ReadHandle<T>
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target
[src]
impl<T, O> Drop for WriteHandle<T, O> where
T: Absorb<O>,
[src]
T: Absorb<O>,
impl<T, O> Send for WriteHandle<T, O> where
T: Absorb<O>,
T: Send,
O: Send,
ReadHandle<T>: Send,
[src]
T: Absorb<O>,
T: Send,
O: Send,
ReadHandle<T>: Send,
Auto Trait Implementations
impl<T, O> !RefUnwindSafe for WriteHandle<T, O>
impl<T, O> !Sync for WriteHandle<T, O>
impl<T, O> Unpin for WriteHandle<T, O> where
O: Unpin,
O: Unpin,
impl<T, O> UnwindSafe for WriteHandle<T, O> where
O: UnwindSafe,
T: RefUnwindSafe,
O: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,