diff options
author | iximeow <me@iximeow.net> | 2019-03-03 19:24:00 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 16:26:39 -0800 |
commit | 7b6bdb989ca2204b288db8675d3066074556dfb1 (patch) | |
tree | 73cfe6d5a265372894a7067ecdd788b97d1b544c /src | |
parent | 5d951e6dd6b130702fffb7238e7cb5daa782ca7d (diff) |
require Arch to have addresses that can += and -=, as well as that instructions have a debug display
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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<Output=Self> + Sub<Output=Self> + + 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<Unit=Self::Address>; + type Instruction: Decodable + LengthedInstruction<Unit=Self::Address> + Debug; type Operand; } pub trait LengthedInstruction { type Unit; fn len(&self) -> Self::Unit; + fn min_size() -> Self::Unit; } |