pub struct ContractFailure { /* private fields */ }Expand description
A failure with safe context and its original typed cause.
Formatting never invokes the provider’s arbitrary Debug implementation.
A panic payload remains available for explicit caller inspection.
§Examples
use qubit_fs_testkit::{ContractFailure, FileSystemContract, FileSystemContractSuite};
let fixture = RustdocSyncFixture::new();
let mut suite = FileSystemContractSuite::new(&fixture);
suite.run_contract(FileSystemContract::Properties);
suite.run_contract(FileSystemContract::Stat);
let report = suite.run();
assert!(!report.failures().is_empty());
let failure: &ContractFailure = &report.failures()[0];
assert!(failure.message().contains("session already started"));Implementations§
Source§impl ContractFailure
impl ContractFailure
Sourcepub const fn check(&self) -> Option<ContractCheckId>
pub const fn check(&self) -> Option<ContractCheckId>
Returns the check identity when execution could attribute the failure.
§Returns
The execution check identity, or None when no check was associated
with the failure.
Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
Returns the diagnostic context without formatting its underlying cause.
§Returns
The safe diagnostic context stored with this failure.
Sourcepub fn take_panic_payload(&self) -> Option<Box<dyn Any + Send>>
pub fn take_panic_payload(&self) -> Option<Box<dyn Any + Send>>
Takes the original panic payload, preserving its concrete type.
This transfers ownership through a borrowed run. Returns None when
the failure was not a panic or another caller already took its payload.
Taking the payload does not remove the failure from the run’s history.
§Returns
The original panic payload when one is retained and has not already
been taken; otherwise, None.
Trait Implementations§
Source§impl Debug for ContractFailure
impl Debug for ContractFailure
Source§impl Display for ContractFailure
impl Display for ContractFailure
Source§impl Error for ContractFailure
impl Error for ContractFailure
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the typed cause retained for standard error-chain inspection.
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()