Skip to main content

AsyncFileSystemContractSuite

Struct AsyncFileSystemContractSuite 

Source
pub struct AsyncFileSystemContractSuite<'a> { /* private fields */ }
Expand description

Runs asynchronous provider contracts against one isolated fixture.

§Type Parameters

  • 'a - Lifetime of the borrowed provider fixture.

§Examples

use qubit_fs_testkit::{AsyncFileSystemContractSuite, FileSystemContract};

let fixture = RustdocAsyncFixture::new();
let mut suite = AsyncFileSystemContractSuite::new(&fixture);
poll_support::ready(async {
    suite.run_contract(FileSystemContract::Properties).await;
});
assert!(!suite.run().was_interrupted());

Implementations§

Source§

impl<'a> AsyncFileSystemContractSuite<'a>

Source

pub async fn finish(&mut self)

Cleans resources created by individually executed asynchronous phases.

The first cleanup attempt closes resource preparation and all run entry points, even when cleanup fails or this future is cancelled. Call finish again to retry cleanup; create a fresh fixture and suite for another run.

§Panics

Panics when a recorded resource cannot be inspected or deleted.

Source

pub fn path(&self, relative: &str) -> Path

Resolves a fixture path or identifies setup failure at the contract boundary.

§Parameters
  • relative - Resource name relative to the current contract phase.
§Returns

The provider path mapped by the fixture.

§Panics

Panics when the fixture cannot map the generated relative name.

Source

pub fn capable(&self, capability: FileSystemCapability) -> bool

Returns whether the cached property snapshot advertises a capability.

§Parameters
  • capability - Capability to query in the captured snapshot.
§Returns

true when the provider advertises the capability.

Source

pub async fn required_seed( &mut self, relative: &str, bytes: &[u8], contract: &str, ) -> Path

Seeds a resource and makes fixture support mandatory for the contract.

§Parameters
  • relative - Resource name relative to the current contract phase.
  • bytes - Exact content to publish.
  • contract - Contract label used in failure diagnostics.
§Returns

The provider path of the seeded file.

§Panics

Panics when cleanup has started, fixture setup fails, or the required seed hook is unsupported. A failed or cancelled cleanup attempt does not reopen resource preparation.

Source§

impl<'a> AsyncFileSystemContractSuite<'a>

Source

pub fn new(fixture: &'a dyn AsyncFileSystemFixture) -> Self

Creates a stateful asynchronous suite borrowing one isolated fixture.

§Parameters
  • fixture - Isolated provider fixture exercised by the suite.
§Returns

A suite with a fresh context and captured property snapshot.

Source

pub fn report(&self) -> &ContractReport

Returns the report currently accumulated by this suite.

§Returns

The checks recorded so far, including checks that are pending or failed.

Source

pub const fn run(&self) -> &ContractRun

Returns retained evidence, including an interrupted execution session.

§Returns

Evidence currently retained by the suite; an interrupted session remains incomplete until cleanup is retried.

Source

pub async fn run_all(&mut self) -> &ContractRun

Executes all phases once and retains evidence across cancellation.

Dropping this future stops I/O and preserves the suite’s cleanup ledger. Call finish to retry cleanup before dropping the fixture owner. A run requested after cleanup has started returns a lifecycle failure; create a fresh fixture and suite for another run.

§Returns

The evidence accumulated so far, including any interrupted execution.

Source

pub async fn run_contract( &mut self, contract: FileSystemContract, ) -> &ContractRun

Executes one phase once and retains its result in the borrowing suite.

Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.

§Parameters
  • contract - Contract phase to execute.
§Returns

Evidence accumulated for the selected phase, including interruption.

Source

pub async fn run_check(&mut self, id: ContractCheckId) -> &ContractRun

Executes one selected check in a fresh session and retains its cleanup result.

Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.

§Parameters
  • id - Identity of the check to execute.
§Returns

Evidence accumulated for the selected check, including interruption.

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