summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 523a8df..b5f92f0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,6 +21,14 @@ pub struct Instruction {
pub opcode: Opcode
}
+impl Default for Instruction {
+ fn default() -> Self {
+ Instruction {
+ opcode: Opcode::NOP
+ }
+ }
+}
+
impl LengthedInstruction for Instruction {
type Unit = <PIC24 as Arch>::Address;
fn min_size() -> Self::Unit {
@@ -65,10 +73,6 @@ pub struct InstDecoder {}
impl Decoder<Instruction> for InstDecoder {
type Error = DecodeError;
- fn decode<T: IntoIterator<Item=u8>>(&self, bytes: T) -> Result<Instruction, Self::Error> {
- let mut blank = Instruction { opcode: Opcode::NOP };
- self.decode_into(&mut blank, bytes).map(|_: ()| blank)
- }
fn decode_into<T: IntoIterator<Item=u8>>(&self, instr: &mut Instruction, bytes: T) -> Result<(), Self::Error> {
match bytes.into_iter().next() {
Some(0x00) => {