yaxpeax_arch

Trait DecodeError

Source
pub trait DecodeError:
    PartialEq
    + Display
    + Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn data_exhausted(&self) -> bool;
    fn bad_opcode(&self) -> bool;
    fn bad_operand(&self) -> bool;
    fn description(&self) -> &'static str;
}
Expand description

the minimum set of errors a yaxpeax-arch disassembler may produce.

it is permissible for an implementor of DecodeError to have items that return false for all these functions; decoders are permitted to error in way that yaxpeax-arch does not know about.

Required Methods§

Source

fn data_exhausted(&self) -> bool

did the decoder fail because it reached the end of input?

Source

fn bad_opcode(&self) -> bool

did the decoder error because the instruction’s opcode is invalid?

this may not be a sensical question for some instruction sets - bad_opcode should generally indicate an issue with the instruction itself. this is in contrast to one specific operand being invalid for the instruction, or some other issue to do with decoding data beyond the top-level instruction. the “opcode”/“operand” distinction is often fuzzy and left as best-effort for decoder implementors.

Source

fn bad_operand(&self) -> bool

did the decoder error because an operand of the instruction to decode is invalid?

similar to DecodeError::bad_opcode, this is a subjective distinction and best-effort on the part of implementors.

Source

fn description(&self) -> &'static str

a human-friendly description of this decode error.

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.

Implementors§