diff options
author | iximeow <me@iximeow.net> | 2020-01-03 18:31:22 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 16:10:14 -0800 |
commit | 6f897e655a5f18b28b47542d76ac88d0aebcbc5d (patch) | |
tree | 4c464e9801e4976360b4d86fa3bfff3f7794b0e4 /src/display.rs | |
parent | e5c38434423e3f0e936c6b9718063866b3e3347c (diff) |
match changes in arch to have Resulty decode, instead of Option
Diffstat (limited to 'src/display.rs')
-rw-r--r-- | src/display.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/display.rs b/src/display.rs index 40bf190..dd46055 100644 --- a/src/display.rs +++ b/src/display.rs @@ -6,7 +6,19 @@ use std::fmt; use yaxpeax_arch::{Colorize, ColorSettings, ShowContextual, YaxColors}; use yaxpeax_arch::display::*; -use ::{RegSpec, RegisterBank, Opcode, Operand, InstDecoder, Instruction, Segment, PrefixRex, OperandSpec}; +use ::{RegSpec, RegisterBank, Opcode, Operand, InstDecoder, Instruction, Segment, PrefixRex, OperandSpec, DecodeError}; + +impl fmt::Display for DecodeError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + DecodeError::ExhaustedInput => { write!(f, "exhausted input") }, + DecodeError::InvalidOpcode => { write!(f, "invalid opcode") }, + DecodeError::InvalidOperand => { write!(f, "invalid operand") }, + DecodeError::InvalidPrefixes => { write!(f, "invalid prefixes") }, + DecodeError::TooLong => { write!(f, "too long") }, + } + } +} impl fmt::Display for InstDecoder { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |