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
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
use crateBuffer;
/// Describes the recovery status of items retained by a synchronous buffered
/// output.
///
/// `Pending` is safe to retry according to completed write results.
/// `Indeterminate` means an inner I/O operation panicked and may have produced
/// external effects that cannot be matched to the retained buffer.
///
/// # Examples
///
/// ```
/// use qubit_io::BufferedOutput;
/// use qubit_io::BufferedOutputRecovery;
/// use std::io::Cursor;
///
/// let mut output = BufferedOutput::with_capacity(Cursor::new(Vec::new()), 8);
/// output.write_fully(b"pending")?;
/// let (inner, recovery) = output.into_parts();
/// match recovery {
/// BufferedOutputRecovery::Pending(buffer) => assert_eq!(buffer.readable(), b"pending"),
/// BufferedOutputRecovery::Indeterminate(_) => unreachable!(),
/// }
/// drop(inner);
/// # Ok::<(), std::io::Error>(())
/// ```