From 0d8563665f1dcd878d41a559313fa0c34cb98afa Mon Sep 17 00:00:00 2001 From: iximeow Date: Wed, 8 May 2019 01:38:21 -0700 Subject: sneak hash/partialeq/etc into yaxpeax-arch --- src/lib.rs | 14 ++++++++++++-- 1 file 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 + 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 + 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(&self, serializer: S) -> Result { + 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>, -- cgit v1.1