From 7b6bdb989ca2204b288db8675d3066074556dfb1 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 3 Mar 2019 19:24:00 -0800 Subject: require Arch to have addresses that can += and -=, as well as that instructions have a debug display --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b72686a..476a094 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ extern crate num_traits; use std::fmt::{Debug, Display}; -use std::ops::{Add, Sub}; +use std::ops::{Add, Sub, AddAssign, SubAssign}; use num_traits::identities; use num_traits::{Bounded, WrappingAdd, WrappingSub, CheckedAdd, CheckedSub}; @@ -17,6 +17,7 @@ pub trait Address where Self: Copy + Clone + Sized + Ord + Eq + PartialEq + Bounded + Add + Sub + + AddAssign + SubAssign + WrappingAdd + WrappingSub + CheckedAdd + CheckedSub + identities::One + identities::Zero { @@ -55,11 +56,12 @@ pub trait Decodable where Self: Sized { pub trait Arch { type Address: Address + Debug; - type Instruction: Decodable + LengthedInstruction; + type Instruction: Decodable + LengthedInstruction + Debug; type Operand; } pub trait LengthedInstruction { type Unit; fn len(&self) -> Self::Unit; + fn min_size() -> Self::Unit; } -- cgit v1.1