scratch_test_model/aux/opcode_trait.rs
1pub trait AsOpcodeName {
2 fn opcode_name(&self) -> &'static str;
3}
4pub trait AsOpcodeUnit {
5 type OpcodeUnit: Copy;
6 #[allow(unused)]
7 fn opcode(&self) -> Self::OpcodeUnit;
8}
9
10impl<T: AsOpcodeName> AsOpcodeName for &T {
11 fn opcode_name(&self) -> &'static str {
12 (*self).opcode_name()
13 }
14}
15impl<T: AsOpcodeUnit> AsOpcodeUnit for &T {
16 type OpcodeUnit = T::OpcodeUnit;
17 fn opcode(&self) -> Self::OpcodeUnit {
18 (*self).opcode()
19 }
20}