Skip to main content

ContractFailure

Struct ContractFailure 

Source
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

Source

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.

Source

pub fn message(&self) -> &str

Returns the diagnostic context without formatting its underlying cause.

§Returns

The safe diagnostic context stored with this failure.

Source

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

Source§

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

Formats safe context without invoking the retained cause formatter.

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

impl Display for ContractFailure

Source§

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

Formats the check identity and safe diagnostic context.

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

impl Error for ContractFailure

Source§

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

👎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.