diff options
author | iximeow <me@iximeow.net> | 2019-04-21 14:22:48 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 17:23:02 -0800 |
commit | a25012283ca5eae5df5adfa5a74b6fd196b5a100 (patch) | |
tree | 134049d3f2195ed2edf4b9c30c22ab8b67197dea | |
parent | 533d753e68dec997006bf512175be926ee53fb58 (diff) |
awful tweaks to expose a serde flag on yaxpeax-arch which will trickle through everything
-rw-r--r-- | Cargo.toml | 7 | ||||
-rw-r--r-- | src/lib.rs | 14 |
2 files changed, 21 insertions, 0 deletions
@@ -11,7 +11,14 @@ A rust pic24 decoder [dependencies] yaxpeax-arch = { path = "../../yaxpeax-arch" } +"serde" = "*" +"serde_derive" = "*" [[test]] name = "test" path = "test/test.rs" + +[features] +default = [] + +use-serde = [] @@ -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}; @@ -41,7 +48,14 @@ impl Decodable for Instruction { } } +#[cfg(feature="use-serde")] +#[derive(Debug, Serialize, Deserialize)] pub struct PIC24; + +#[cfg(not(feature="use-serde"))] +#[derive(Debug)] +pub struct PIC24; + impl Arch for PIC24 { type Address = u32; type Instruction = Instruction; |