aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-05-08 01:38:21 -0700
committeriximeow <me@iximeow.net>2020-01-12 16:26:39 -0800
commit0d8563665f1dcd878d41a559313fa0c34cb98afa (patch)
tree9b280a65eac10bf484f64b5085e4e2d5d067c3e7
parentcd2881ff02ae5c90bf459581df9dcdef1535ab23 (diff)
sneak hash/partialeq/etc into yaxpeax-arch
-rw-r--r--src/lib.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8f98366..0c0870b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,6 +4,7 @@ extern crate termion;
extern crate serde;
use std::str::FromStr;
+use std::hash::Hash;
use std::fmt::{Debug, Display, Formatter};
@@ -165,14 +166,14 @@ pub trait Decodable where Self: Sized {
#[cfg(feature="use-serde")]
pub trait Arch {
- type Address: Address + Debug + Serialize + for<'de> Deserialize<'de>;
+ type Address: Address + Debug + Hash + PartialEq + Eq + Serialize + for<'de> Deserialize<'de>;
type Instruction: Decodable + LengthedInstruction<Unit=Self::Address> + Debug;
type Operand;
}
#[cfg(not(feature="use-serde"))]
pub trait Arch {
- type Address: Address + Debug;
+ type Address: Address + Debug + Hash + PartialEq + Eq;
type Instruction: Decodable + LengthedInstruction<Unit=Self::Address> + Debug;
type Operand;
}
@@ -183,6 +184,15 @@ pub trait LengthedInstruction {
fn min_size() -> Self::Unit;
}
+#[cfg(feature="use-serde")]
+impl Serialize for ColorSettings {
+ fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
+ use serde::ser::SerializeStruct;
+ let mut s = serializer.serialize_struct("ColorSettings", 0)?;
+ s.end()
+ }
+}
+
pub struct ColorSettings {
arithmetic: color::Fg<&'static color::Color>,
stack: color::Fg<&'static color::Color>,