aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-04-21 14:17:00 -0700
committeriximeow <me@iximeow.net>2020-01-12 17:28:07 -0800
commit0ef3cdf12d5a5087bf95e1d8820723536a28a0cf (patch)
tree4ad5cbf9d1f454e96e5a559bb294b39727cf91d3
parent00aa1ab7515f7dee7dcdfc28b3f942c30671677a (diff)
awful tweaks to expose a serde flag on yaxpeax-arch which will trickle through everything
-rw-r--r--Cargo.toml7
-rw-r--r--src/armv7.rs9
-rw-r--r--src/lib.rs4
3 files changed, 20 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d9f2b9c..641c3dc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,8 @@ A rust arm decoder
[dependencies]
yaxpeax-arch = { path = "../../yaxpeax-arch" }
+"serde" = "*"
+"serde_derive" = "*"
[[test]]
name = "test"
@@ -19,3 +21,8 @@ path = "test/test.rs"
[[bench]]
name = "bench"
path = "test/test.rs"
+
+[features]
+default = []
+
+use-serde = []
diff --git a/src/armv7.rs b/src/armv7.rs
index 5ac7a7c..ab12797 100644
--- a/src/armv7.rs
+++ b/src/armv7.rs
@@ -1,3 +1,6 @@
+#[cfg(feature="use-serde")]
+use serde::{Serialize, Deserialize};
+
use std::fmt::{Display, Formatter};
use yaxpeax_arch::{Arch, Colorize, Colored, ColorSettings, Decodable, LengthedInstruction, ShowContextual, YaxColors};
@@ -1190,8 +1193,14 @@ impl Decodable for Instruction {
}
}
+#[cfg(feature="use-serde")]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct ARMv7;
+
+#[cfg(not(feature="use-serde"))]
#[derive(Debug)]
pub struct ARMv7;
+
impl Arch for ARMv7 {
type Address = u32;
type Instruction = Instruction;
diff --git a/src/lib.rs b/src/lib.rs
index 88c01b0..dba62c8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,7 @@
+#[cfg(feature="use-serde")]
+#[macro_use] extern crate serde_derive;
+#[cfg(feature="use-serde")]
+extern crate serde;
extern crate yaxpeax_arch;
pub mod armv7;