Trait yaxpeax_arch::Decoder
source · [−]pub trait Decoder<A: Arch + ?Sized> {
fn decode_into<T: Reader<A::Address, A::Word>>(
&self,
inst: &mut A::Instruction,
words: &mut T
) -> Result<(), A::DecodeError>;
fn decode<T: Reader<A::Address, A::Word>>(
&self,
words: &mut T
) -> Result<A::Instruction, A::DecodeError> { ... }
}
Expand description
an interface to decode Arch::Instruction
words from a reader of Arch::Word
s. errors are
the architecture-defined DecodeError
implemention.
Required Methods
sourcefn decode_into<T: Reader<A::Address, A::Word>>(
&self,
inst: &mut A::Instruction,
words: &mut T
) -> Result<(), A::DecodeError>
fn decode_into<T: Reader<A::Address, A::Word>>(
&self,
inst: &mut A::Instruction,
words: &mut T
) -> Result<(), A::DecodeError>
decode one instruction for this architecture from the crate::Reader
of this
architecture’s Word
, writing into the provided inst
.
SAFETY:
while inst
MUST be left in a state that does not violate Rust’s safety guarantees,
implementors are NOT obligated to leave inst
in a semantically meaningful state if
decoding fails. if decode_into
returns an error, callers may find contradictory and
useless information in inst
, as well as stale data from whatever was passed in.
Provided Methods
sourcefn decode<T: Reader<A::Address, A::Word>>(
&self,
words: &mut T
) -> Result<A::Instruction, A::DecodeError>
fn decode<T: Reader<A::Address, A::Word>>(
&self,
words: &mut T
) -> Result<A::Instruction, A::DecodeError>
decode one instruction for this architecture from the crate::Reader
of this
architecture’s Word
.