summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-01-18 14:33:45 -0800
committeriximeow <me@iximeow.net>2020-01-18 14:33:45 -0800
commit6d645f565675a491ba3497a71e3721cf9aea8b11 (patch)
tree27300fbfe81dec27d5c866472246774aa5b3728d
parent9f27904de0ee0698eb5ab817b4755de45b140ccc (diff)
move pic24 to yaxpeax-arch cratemaster
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs12
2 files changed, 9 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b83935f..f34213a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ repository = "http://git.iximeow.net/yaxpeax-pic24/"
description = "pic24 decoders for the yaxpeax project"
[dependencies]
-yaxpeax-arch = { path = "../../yaxpeax-arch" }
+yaxpeax-arch = { version = "0.0.2", default-features = false, features = [] }
"serde" = "*"
"serde_derive" = "*"
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) => {