aboutsummaryrefslogtreecommitdiff
path: root/src/isa
diff options
context:
space:
mode:
Diffstat (limited to 'src/isa')
-rw-r--r--src/isa/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/isa/mod.rs b/src/isa/mod.rs
index d5a5c14..8d86610 100644
--- a/src/isa/mod.rs
+++ b/src/isa/mod.rs
@@ -59,7 +59,7 @@ macro_rules! isa_type_assign_op {
macro_rules! isa_type {
($name: ident, $utype: ty) => {
- #[derive(Clone,Copy,Debug,Eq,Ord,PartialEq,PartialOrd)]
+ #[derive(Clone,Copy,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)]
pub struct $name(pub $utype);
impl $name {
@@ -85,6 +85,12 @@ macro_rules! isa_type {
isa_type_op!($name, $utype, BitOr, bitor);
isa_type_op!($name, $utype, BitXor, bitxor);
+ impl fmt::Display for $name {
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ write!(f, "{}", self.0)
+ }
+ }
+
impl fmt::LowerHex for $name {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(f, "{:x}", self.0)