Skip to main content

FastCasError

Enum FastCasError 

Source
pub enum FastCasError<E> {
    Abort {
        current: usize,
        error: E,
        attempts: u32,
    },
    Conflict {
        current: usize,
        attempts: u32,
    },
}
Expand description

Terminal crate::FastCas failure.

Variants§

§

Abort

The operation aborted from a user decision.

Fields

§current: usize

State observed by the aborting attempt.

§error: E

Business error returned by the operation.

§attempts: u32

Number of attempts consumed before aborting.

§

Conflict

CAS conflicts exhausted the retry policy.

Fields

§current: usize

Most recent state observed after the final failed CAS.

§attempts: u32

Number of attempts consumed before giving up.

Implementations§

Source§

impl<E> FastCasError<E>

Source

pub const fn current(&self) -> usize

Returns the current state captured by the terminal failure.

§Returns

The observed state code at failure.

Source

pub const fn attempts(&self) -> u32

Returns the number of attempts consumed before failure.

§Returns

Number of attempts executed by the operation.

Source

pub const fn is_abort(&self) -> bool

Tests whether this failure came from an abort decision.

§Returns

true for FastCasError::Abort.

Source

pub const fn is_conflict(&self) -> bool

Tests whether this failure came from exhausted CAS conflicts.

§Returns

true for FastCasError::Conflict.

Source

pub const fn error(&self) -> Option<&E>

Returns the business error for abort failures.

§Returns

Some(error) for abort failures, or None for conflict failures.

Source

pub fn into_error(self) -> Option<E>

Consumes this failure and returns the business error when present.

§Returns

Some(error) for abort failures, or None for conflict failures.

Trait Implementations§

Source§

impl<E: Clone> Clone for FastCasError<E>

Source§

fn clone(&self) -> FastCasError<E>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug> Debug for FastCasError<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: PartialEq> PartialEq for FastCasError<E>

Source§

fn eq(&self, other: &FastCasError<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Copy> Copy for FastCasError<E>

Source§

impl<E: Eq> Eq for FastCasError<E>

Source§

impl<E> StructuralPartialEq for FastCasError<E>

Auto Trait Implementations§

§

impl<E> Freeze for FastCasError<E>
where E: Freeze,

§

impl<E> RefUnwindSafe for FastCasError<E>
where E: RefUnwindSafe,

§

impl<E> Send for FastCasError<E>
where E: Send,

§

impl<E> Sync for FastCasError<E>
where E: Sync,

§

impl<E> Unpin for FastCasError<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for FastCasError<E>
where E: UnsafeUnpin,

§

impl<E> UnwindSafe for FastCasError<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResult<T> for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.