summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml7
-rw-r--r--src/lib.rs13
2 files changed, 20 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 384bae6..58a1c5f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,14 @@ A rust msp430 decoder (specifically the microcorruption flavor)
[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 81ceceb..7ba7a95 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;
@@ -5,8 +12,14 @@ use yaxpeax_arch::{Arch, Decodable, LengthedInstruction};
mod display;
+#[cfg(feature="use-serde")]
+#[derive(Debug, Serialize, Deserialize)]
+pub struct MSP430;
+
+#[cfg(not(feature="use-serde"))]
#[derive(Debug)]
pub struct MSP430;
+
impl Arch for MSP430 {
type Address = u16;
type Instruction = Instruction;