pub struct ICoWCopy<'copy, ITEM: Debug + Send> { /* private fields */ }Expand description
A write-guard which holds new value to which the new values are written. And
previous value too. This type of guard is not exclusive, so it does not prevent
multiple CoW operations. Normally, if some object which may be written
simultaniously i.e lost connection to remote server and reconnect is required,
the exclusive lock would be more desirable.
Implementations§
Source§impl<'copy, ITEM: Debug + Send> ICoWCopy<'copy, ITEM>
impl<'copy, ITEM: Debug + Send> ICoWCopy<'copy, ITEM>
Sourcepub fn commit(self) -> Result<(), (ICoWError, Self)>
pub fn commit(self) -> Result<(), (ICoWError, 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.
§Returns
The Result::Err is returned with:
Error types ICoWError:
-
ICoWError::ExclusiveLockPending - if exclusivly locked from another thread.
-
ICoWError::WouldBlock - if “exponential backoff has completed and blocking the thread is advised”.