From 139effe81d625439946e8ae3c77e329e2b56710d Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 21 Apr 2019 14:22:35 -0700 Subject: awful tweaks to expose a serde flag on yaxpeax-arch which will trickle through everything --- Cargo.toml | 7 +++++++ src/lib.rs | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index c70191d..4f10a3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,14 @@ A rust pic18 decoder [dependencies] yaxpeax-arch = { path = "../../yaxpeax-arch" } +"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 f9137fa..c2c30a3 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; use yaxpeax_arch::{Arch, Decodable, LengthedInstruction}; @@ -5,7 +12,14 @@ use yaxpeax_arch::{Arch, Decodable, LengthedInstruction}; pub mod consts; pub mod display; +#[cfg(feature="use-serde")] +#[derive(Debug, Serialize, Deserialize)] +pub struct PIC18; + +#[cfg(not(feature="use-serde"))] +#[derive(Debug)] pub struct PIC18; + impl Arch for PIC18 { type Address = u32; type Instruction = Instruction; -- cgit v1.1