pub enum CasSuccess<T, R> {
Updated {
previous: Arc<T>,
current: Arc<T>,
output: R,
context: CasContext,
},
Finished {
current: Arc<T>,
output: R,
context: CasContext,
},
}Expand description
Successful result returned by crate::CasExecutor.
Variants§
Updated
The executor installed a new state by compare-and-swap.
Fields
§
output: RBusiness output returned by the operation.
§
context: CasContextRetry context captured when the flow completed.
Finished
The executor finished successfully without writing a new state.
Fields
§
output: RBusiness output returned by the operation.
§
context: CasContextRetry context captured when the flow completed.
Implementations§
Source§impl<T, R> CasSuccess<T, R>
impl<T, R> CasSuccess<T, R>
Sourcepub fn is_updated(&self) -> bool
pub fn is_updated(&self) -> bool
Returns whether this success performed a write.
§Returns
true for CasSuccess::Updated, false for
CasSuccess::Finished.
Sourcepub fn previous(&self) -> Option<&Arc<T>>
pub fn previous(&self) -> Option<&Arc<T>>
Returns the previous state when a write occurred.
§Returns
Some(&Arc<T>) for CasSuccess::Updated, or None when no write
occurred.
Sourcepub fn into_output(self) -> R
pub fn into_output(self) -> R
Sourcepub fn context(&self) -> CasContext
pub fn context(&self) -> CasContext
Trait Implementations§
Source§impl<T: Clone, R: Clone> Clone for CasSuccess<T, R>
impl<T: Clone, R: Clone> Clone for CasSuccess<T, R>
Source§fn clone(&self) -> CasSuccess<T, R>
fn clone(&self) -> CasSuccess<T, R>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Eq, R: Eq> Eq for CasSuccess<T, R>
impl<T, R> StructuralPartialEq for CasSuccess<T, R>
Auto Trait Implementations§
impl<T, R> Freeze for CasSuccess<T, R>where
R: Freeze,
impl<T, R> RefUnwindSafe for CasSuccess<T, R>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for CasSuccess<T, R>
impl<T, R> Sync for CasSuccess<T, R>
impl<T, R> Unpin for CasSuccess<T, R>where
R: Unpin,
impl<T, R> UnsafeUnpin for CasSuccess<T, R>where
R: UnsafeUnpin,
impl<T, R> UnwindSafe for CasSuccess<T, R>where
R: UnwindSafe,
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