pub struct ICoWCopy<'copy, ITEM: Sized> { /* private fields */ }Expand description
A write-guard which holds new value to which the new data is written. And previous value too. This type of guard is not exclusive, so multiple CoW operations may be performed in parallel which is not normally needed.
The changes made in the current instance becomes visible for the rest of the threads only after commit.
Implementations§
Source§impl<'copy, ITEM: Sized> ICoWCopy<'copy, ITEM>
impl<'copy, ITEM: Sized> ICoWCopy<'copy, ITEM>
Sourcepub fn commit(self)
pub fn commit(self)
Commits the changes made in the guarded variable. A non-blocking
function. It will not block the thread completly and returns the
[ICoWError::WouldBlock] if attempt to grab the pointer atomically
fails in reasonable time. for blocking commit use
[Self::commit_blocking].
Sourcepub fn into_inner(self) -> ITEM
pub fn into_inner(self) -> ITEM
Drops the instance without commiting changes returning
a copy, clone, default, or new i.e what was in the new field
of the instance.
Trait Implementations§
Auto Trait Implementations§
impl<'copy, ITEM> Freeze for ICoWCopy<'copy, ITEM>where
ITEM: Freeze,
impl<'copy, ITEM> !RefUnwindSafe for ICoWCopy<'copy, ITEM>
impl<'copy, ITEM> !Send for ICoWCopy<'copy, ITEM>
impl<'copy, ITEM> !Sync for ICoWCopy<'copy, ITEM>
impl<'copy, ITEM> Unpin for ICoWCopy<'copy, ITEM>where
ITEM: Unpin,
impl<'copy, ITEM> !UnwindSafe for ICoWCopy<'copy, ITEM>
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