Skip to main content

ContractWriterFailure

Struct ContractWriterFailure 

Source
pub struct ContractWriterFailure<W> { /* private fields */ }
Expand description

A failed streaming operation whose writer remains available for recovery.

§Type Parameters

  • W: The writer or owning operation retained for explicit recovery.

W is the synchronous or asynchronous writer, or an owning asynchronous write/copy operation retained after a cancellation diagnostic failure. Obtain this value through crate::ContractSource::take and downcast to the concrete type. For ContractWriterFailure<AsyncWriteAllOperation> or ContractWriterFailure<AsyncCopyOperation>, error() contains the original diagnostic crate::ContractFailure, and writer_mut() exposes the operation. Call its take_recovery() and explicitly abort the returned writer when recovery is required. Taking the source transfers recovery responsibility to the caller. Formatting does not inspect the retained value or invoke a provider error formatter.

§Examples

Downcast the error returned from crate::ContractSource::take to the concrete writer failure, then inspect the retained writer:

use qubit_fs_testkit::ContractWriterFailure;

fn inspect_writer<W>(failure: &ContractWriterFailure<W>) -> &W {
    failure.writer()
}

Implementations§

Source§

impl<W> ContractWriterFailure<W>

Source

pub fn error(&self) -> &(dyn Error + Send + 'static)

Returns the original error for typed inspection.

Source

pub const fn writer(&self) -> &W

Borrows the retained writer for lifecycle inspection.

Source

pub fn writer_mut(&mut self) -> &mut W

Borrows the retained writer for explicit recovery or abort.

Source

pub fn into_parts(self) -> (Box<dyn Error + Send>, W)

Transfers both the original error and its writer to the caller.

Trait Implementations§

Source§

impl<W> Debug for ContractWriterFailure<W>

Source§

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

Formats a stable summary without invoking the retained error formatter.

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

impl<W> Display for ContractWriterFailure<W>

Source§

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

Formats a stable description of the retained streaming failure.

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

impl<W> Error for ContractWriterFailure<W>

Source§

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

Exposes the retained original error 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.