Trait yaxpeax_arch::Arch
source · [−]pub trait Arch {
type Word: Debug + Display + PartialEq + Eq;
type Address: AddressBounds;
type Instruction: Instruction + LengthedInstruction<Unit = AddressDiff<Self::Address>> + Debug + Default + Sized;
type DecodeError: DecodeErrorBounds + Debug + Display;
type Decoder: Decoder<Self> + Default;
type Operand;
}
Expand description
a collection of associated type parameters that constitute the definitions for an instruction
set. Arch
provides an Instruction
and its associated Operand
s, which is guaranteed to be
decodable by this Arch::Decoder
. Arch::Decoder
can always be constructed with a Default
implementation, and decodes from a Reader<Arch::Address, Arch::Word>
.
Arch
is suitable as the foundational trait to implement more complex logic on top of; for
example, it would be entirely expected to have a
pub fn emulate<A: Arch, E: Emulator<A>>(
reader: &mut Reader<A::Address, A::Word>,
emu: &mut E
) -> Result<A::Address, DecodeOrEvaluationError>;
in some library built on top of yaxpeax-arch
.