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>
impl<W> ContractWriterFailure<W>
Sourcepub fn error(&self) -> &(dyn Error + Send + 'static)
pub fn error(&self) -> &(dyn Error + Send + 'static)
Returns the original error for typed inspection.
Sourcepub fn writer_mut(&mut self) -> &mut W
pub fn writer_mut(&mut self) -> &mut W
Borrows the retained writer for explicit recovery or abort.
Sourcepub fn into_parts(self) -> (Box<dyn Error + Send>, W)
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>
impl<W> Debug for ContractWriterFailure<W>
Source§impl<W> Display for ContractWriterFailure<W>
impl<W> Display for ContractWriterFailure<W>
Source§impl<W> Error for ContractWriterFailure<W>
impl<W> Error for ContractWriterFailure<W>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
use the Display impl or to_string()