summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-01-18 14:33:11 -0800
committeriximeow <me@iximeow.net>2020-01-18 14:33:11 -0800
commit8e0ab8a90137c565ab727eaa37ef3a6d9564f13c (patch)
treea9394a58320a68f745605e84018758daeca04813
parent03a5487c5819b15ca31f78db2372b1e09cc23718 (diff)
get pic18 towards using no_std, switch to yaxpeax-arch crate
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs8
2 files changed, 3 insertions, 7 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ec0a2e2..4e93bb7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ repository = "http://git.iximeow.net/yaxpeax-pic18/"
description = "pic18 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 c29f190..506a0e5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,8 +84,8 @@ impl yaxpeax_arch::Instruction for Instruction {
fn well_defined(&self) -> bool { true }
}
-impl Instruction {
- pub fn blank() -> Instruction {
+impl Default for Instruction {
+ fn default() -> Instruction {
Instruction {
opcode: Opcode::NOP,
operands: [Operand::Nothing, Operand::Nothing]
@@ -196,10 +196,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::blank();
- self.decode_into(&mut blank, bytes).map(|_: ()| blank)
- }
fn decode_into<T: IntoIterator<Item=u8>>(&self, inst: &mut Instruction, bytes: T) -> Result<(), Self::Error> {
let mut bytes_iter = bytes.into_iter();
let word: Vec<u8> = bytes_iter.by_ref().take(2).collect();