From 9685d26ebe2982866c46531dddb36781eecc512f Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 21 Apr 2019 14:17:39 -0700 Subject: awful tweaks to expose a serde flag on yaxpeax-arch which will trickle through everything --- Cargo.toml | 7 +++++++ src/lib.rs | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6885dee..dd5ca2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,14 @@ A rust pic17 decoder [dependencies] yaxpeax-arch = { path = "../../yaxpeax-arch" } "termion" = "1.4.0" +"serde" = "*" +"serde_derive" = "*" [[test]] name = "test" path = "test/test.rs" + +[features] +default = [] + +use-serde = [] diff --git a/src/lib.rs b/src/lib.rs index 1bc0c6f..c082214 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,10 @@ +#[cfg(feature="use-serde")] +#[macro_use] extern crate serde_derive; +#[cfg(feature="use-serde")] +extern crate serde; +#[cfg(feature="use-serde")] +use serde::{Serialize, Deserialize}; + extern crate yaxpeax_arch; extern crate termion; @@ -13,8 +20,14 @@ pub struct Instruction { pub operands: [Operand; 2] } +#[cfg(feature="use-serde")] +#[derive(Debug, Serialize, Deserialize)] +pub struct PIC17; + +#[cfg(not(feature="use-serde"))] #[derive(Debug)] pub struct PIC17; + impl Arch for PIC17 { type Address = u16; type Instruction = Instruction; -- cgit v1.1