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
//! Type-safe operation trait for Op enum integration.
//!
//! This module provides the bridge between typed operations and the type-erased Op enum.
//! The [`TypedOp`] trait maintains compile-time type safety while allowing operations
//! to be executed through the unified Op enum interface.
use crateOp;
/// Core trait for type-safe operations that can be converted to Op enum.
///
/// This trait provides a bridge between strongly-typed operations and the
/// type-erased [`Op`] enum used by backends. Each operation implements this
/// trait to maintain its type information throughout the execution pipeline.
///
/// # Type Safety
///
/// - The `Result` associated type is tied to the operation at compile time
/// - Result extraction is guaranteed to return the correct type
/// - No unsafe pointer casting needed
///
/// # Example
///
/// ```rust,ignore
/// struct Read<T> { /* ... */ }
///
/// impl<T: BufLike> TypedOp for Read<T> {
/// type Result = BufResult<i32, T>;
///
/// fn into_op(self) -> Op {
/// // Convert to type-erased Op
/// }
///
/// fn extract_result(op_result: OpResult) -> Option<Self::Result> {
/// // Safely extract the correct result type
/// }
/// }
/// ```
;