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
//! Operation state types and state machine definitions.
//!
//! This module defines the state types used in the Operation state machine
//! and the sealed OperationState trait that ensures type safety.
/// Marker trait for operation states.
///
/// This trait is sealed to prevent external implementations and ensure
/// that only valid states can be used with operations.
/// Operation is being built and can be configured.
///
/// In this state, the operation can have its parameters modified but cannot
/// be submitted to the kernel. This prevents incomplete operations from being
/// submitted accidentally.
;
/// Operation has been submitted and is in flight.
///
/// In this state, the operation cannot be modified but can be polled for
/// completion. The operation ID is used to track the operation in the kernel.
/// Operation has completed with a result.
///
/// In this state, the operation result can be extracted along with the
/// buffer ownership. This is the terminal state for operations.
// Implement the sealed trait for all valid states
/// Private module to seal the OperationState trait.
///
/// This prevents external crates from implementing OperationState,
/// ensuring type safety of the state machine.