From 153e8b77d364893a460a7d779347febae36e5b5a Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 21 Apr 2019 14:22:57 -0700 Subject: awful tweaks to expose a serde flag on yaxpeax-arch which will trickle through everything --- Cargo.toml | 2 ++ src/lib.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d98a94e..dcee616 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,5 @@ default = [] # This enables some capstone benchmarks over the same # instruction bytes used to bench this code. capstone_bench = [] + +use-serde = [] diff --git a/src/lib.rs b/src/lib.rs index d0dbba3..8057114 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; @@ -333,9 +340,16 @@ pub struct Instruction { pub length: u8 } +#[cfg(feature="use-serde")] +#[derive(Debug, Serialize, Deserialize)] +#[allow(non_camel_case_types)] +pub struct x86_64; + +#[cfg(not(feature="use-serde"))] #[derive(Debug)] #[allow(non_camel_case_types)] pub struct x86_64; + impl Arch for x86_64 { type Address = u64; type Instruction = Instruction; -- cgit v1.1