pub trait Decoder<A: Arch + ?Sized> {
// Required method
fn decode_into<T: Reader<A::Address, A::Word>>(
&self,
inst: &mut A::Instruction,
words: &mut T,
) -> Result<(), A::DecodeError>;
// Provided method
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::Words. 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.