qubit_fs/write/async_write_all_operation_state.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! State for an owning asynchronous whole-file write.
9use crate::write::WriteFailureState;
10/// Lifecycle state of an owning asynchronous whole-file write.
11///
12/// # Examples
13///
14/// ```rust
15/// use qubit_fs::write::AsyncWriteAllOperationState;
16/// use qubit_fs::write::WriteFailureState;
17///
18/// let initial = AsyncWriteAllOperationState::Ready;
19/// assert_eq!(initial, AsyncWriteAllOperationState::Ready);
20///
21/// let failed = AsyncWriteAllOperationState::Failed(WriteFailureState::NotPublished);
22/// assert_eq!(
23/// failed,
24/// AsyncWriteAllOperationState::Failed(WriteFailureState::NotPublished),
25/// );
26/// ```
27#[derive(Clone, Copy, Debug, Eq, PartialEq)]
28#[must_use]
29pub enum AsyncWriteAllOperationState {
30 /// The operation has not been polled.
31 Ready,
32 /// The provider call is in progress and has not completed.
33 Running,
34 /// The target was published successfully.
35 Completed,
36 /// The operation stopped with the paired publication state.
37 Failed(
38 /// Publication state associated with the failed operation.
39 WriteFailureState,
40 ),
41}