1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Cleanup evidence retained across explicit retries.
use crate::ContractFailure;
/// Cleanup attempts and their historical failures.
///
/// A later successful teardown does not erase a failed facade deletion.
///
/// # Examples
///
/// ```
/// # mod support { include!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/common/rustdoc_support.rs")); }
/// # use support::RustdocSyncFixture;
/// use qubit_fs_testkit::{FileSystemContract, FileSystemContractSuite};
///
/// let fixture = RustdocSyncFixture::new();
/// let mut suite = FileSystemContractSuite::new(&fixture);
/// suite.run_contract(FileSystemContract::Properties);
/// assert!(suite.run().cleanup().completed());
/// ```
#[must_use]
pub struct CleanupReport {
pub(crate) attempts: usize,
pub(crate) completed: bool,
pub(crate) failures: Vec<ContractFailure>,
}
impl CleanupReport {
/// Returns the number of cleanup attempts started, including cancelled
/// ones.
#[must_use]
pub const fn attempts(&self) -> usize {
self.attempts
}
/// Returns whether the latest cleanup attempt returned successfully.
#[must_use]
pub const fn completed(&self) -> bool {
self.completed
}
/// Returns every observed failure, including failures before a retry.
pub fn failures(&self) -> &[ContractFailure] {
&self.failures
}
/// Creates an empty cleanup history.
pub(crate) const fn new() -> Self {
Self {
attempts: 0,
completed: false,
failures: Vec::new(),
}
}
}