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
//! Multi-decoder routing primitive for transaction-level instruction dispatch.
//!
//! # Overview
//!
//! `Pipeline::transaction(...)` evaluates each instruction in a transaction
//! against a unified enum. `InstructionDecoderCollection` defines this enum,
//! where each variant wraps the `InstructionType` of a registered decoder.
//! `parse_instruction` selects the matching variant for a given instruction.
//!
//! Typical usage is a hand-written wrapper enum over all relevant decoders,
//! with `parse_instruction` attempting each decoder sequentially.
//!
//! # Notes
//!
//! - `Eq + Hash + Serialize` are required for internal routing and persistence.
//! - Generated decoders (e.g. Codama) usually lack these bounds, so the wrapper
//! enum is maintained manually or via macro.
use Serialize;
/// Enum-based instruction router used by `Pipeline::transaction(...)`.
///
/// Implemented as a wrapper over multiple decoders, enabling unified
/// dispatch of heterogeneous instruction types.
///
/// # Associated Types
///
/// - [`InstructionType`](Self::InstructionType): Discriminant returned by
/// [`get_type`](Self::get_type), used for routing within the pipe.