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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Ownership retained after an aggregate write or copy failure.
use Debug;
use Formatter;
use Result as FmtResult;
use crateAsyncFileWriter;
use crateRejectedAsyncWriter;
/// A retained session that is either validated or restricted to explicit
/// cleanup.
///
/// Matching the variant is required before performing recovery. A rejected
/// session cannot write or publish data. This value does not describe the
/// historical publication state; use the failure snapshot for that fact.
/// Recovery values come from an operation through `recovery` or
/// `take_recovery`. This mutable-borrow helper leaves ownership with the
/// caller if abort fails.
///
/// # Examples
///
/// The caller supplies a retained recovery value from an operation.
///
/// ```rust
/// use qubit_fs::error::FsResult;
/// use qubit_fs::write::{AsyncWriterRecovery, WriteAbortOutcome};
///
/// async fn abort_retained(
/// recovery: &mut AsyncWriterRecovery,
/// ) -> FsResult<WriteAbortOutcome> {
/// match recovery {
/// AsyncWriterRecovery::Opened(writer) => writer.abort_async().await,
/// AsyncWriterRecovery::Rejected(writer) => writer.abort_async().await,
/// }
/// }
/// ```