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
impl ContractAsyncCopyFailure
Sourcepub const fn failure(&self) -> &AsyncCopyFailure
pub const fn failure(&self) -> &AsyncCopyFailure
Returns the failure’s publication state and partial transfer statistics snapshot.
Sourcepub const fn operation(&self) -> Option<&AsyncCopyOperation>
pub const fn operation(&self) -> Option<&AsyncCopyOperation>
Borrows the operation if request admission succeeded.
Sourcepub fn operation_mut(&mut self) -> Option<&mut AsyncCopyOperation>
pub fn operation_mut(&mut self) -> Option<&mut AsyncCopyOperation>
Borrows the operation for explicit recovery writer transfer or inspection.
Sourcepub fn into_parts(self) -> (AsyncCopyFailure, Option<AsyncCopyOperation>)
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
impl Debug for ContractAsyncCopyFailure
Source§impl Display for ContractAsyncCopyFailure
impl Display for ContractAsyncCopyFailure
Source§impl Error for ContractAsyncCopyFailure
impl Error for ContractAsyncCopyFailure
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
use the Display impl or to_string()