atlas_arch/collection.rs
1use {
2 crate::instruction::DecodedInstruction, arch_program::instruction::Instruction,
3 serde::Serialize,
4};
5
6/// A set of instruction decoders used to parse nested instructions.
7///
8/// Implementors typically enumerate all supported instruction variants for a
9/// given program and provide a way to parse and tag them with a type.
10pub trait InstructionDecoderCollection:
11 Clone + std::fmt::Debug + Send + Sync + Eq + std::hash::Hash + Serialize + 'static
12{
13 type InstructionType: Clone + std::fmt::Debug + PartialEq + Eq + Send + Sync + 'static;
14
15 fn parse_instruction(instruction: &Instruction) -> Option<DecodedInstruction<Self>>;
16 fn get_type(&self) -> Self::InstructionType;
17}