Skip to main content

ContractAsyncCopyFailure

Struct ContractAsyncCopyFailure 

Source
pub struct ContractAsyncCopyFailure { /* private fields */ }
Expand description

Retains a copy failure snapshot and its operation, when admitted.

Obtain this value through crate::ContractSource::take and downcast it. Admission failures have no operation. Execution failures retain the operation even when it has no recovery writer. Taking this value transfers any recovery responsibility to the caller; dropping it does not perform asynchronous abort. Formatting never invokes a provider formatter.

§Examples

When an asynchronous copy check reports a failure, retrieve the retained operation from its source chain and inspect the filesystem error:

use std::error::Error;

use qubit_fs::error::FsError;
use qubit_fs::error::FsErrorKind;
use qubit_fs_testkit::AsyncFileSystemContractSuite;
use qubit_fs_testkit::AsyncFileSystemFixture;
use qubit_fs_testkit::ContractAsyncCopyFailure;
use qubit_fs_testkit::ContractCheckId;
use qubit_fs_testkit::ContractSource;

fn inspect_error(failure: &ContractAsyncCopyFailure) {
    let original_error: &FsError = failure.error();
    assert!(!original_error.to_string().is_empty());
}

Implementations§

Source§

impl ContractAsyncCopyFailure

Source

pub const fn error(&self) -> &FsError

Returns the original filesystem error.

Source

pub const fn failure(&self) -> &AsyncCopyFailure

Returns the failure’s publication state and partial transfer statistics snapshot.

Source

pub const fn operation(&self) -> Option<&AsyncCopyOperation>

Borrows the operation if request admission succeeded.

Source

pub fn operation_mut(&mut self) -> Option<&mut AsyncCopyOperation>

Borrows the operation for explicit recovery writer transfer or inspection.

Source

pub fn into_parts(self) -> (AsyncCopyFailure, Option<AsyncCopyOperation>)

Transfers the failure snapshot and optional operation to the caller.

§Returns

The immutable failure facts and the operation when request admission succeeded.

Trait Implementations§

Source§

impl Debug for ContractAsyncCopyFailure

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats a stable summary without invoking provider error formatting.

§Parameters
  • formatter: Destination for the stable summary.
Source§

impl Display for ContractAsyncCopyFailure

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats a stable description of the retained copy failure.

§Parameters
  • formatter: Destination for the failure description.
Source§

impl Error for ContractAsyncCopyFailure

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Exposes the retained copy failure as the standard error source.

1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.