vihaco_runtime/
inspection.rs1use std::{any::Any, fmt::Debug};
5
6pub trait InspectInstruction {
8 fn inspect<R>(&self, inspect: impl FnOnce(InstructionView<'_>) -> R) -> R;
9}
10
11pub struct InstructionView<'a> {
13 pub device_path: &'static [&'static str],
14 pub dialect: &'static str,
15 pub mnemonic: &'static str,
16 pub operands: Option<&'a [InstructionOperand<'a>]>,
18 pub leaf: &'a dyn Debug,
19}
20
21pub struct InstructionOperand<'a> {
23 pub debug: &'a dyn Debug,
24 pub value: &'a dyn Any,
25}
26
27#[doc(hidden)]
29pub trait InspectOperands {
30 fn inspect_operands<R>(
31 &self,
32 inspect: impl FnOnce(Option<&[InstructionOperand<'_>]>) -> R,
33 ) -> R;
34}