aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-03-03 19:24:00 -0800
committeriximeow <me@iximeow.net>2020-01-12 16:26:39 -0800
commit7b6bdb989ca2204b288db8675d3066074556dfb1 (patch)
tree73cfe6d5a265372894a7067ecdd788b97d1b544c /src/lib.rs
parent5d951e6dd6b130702fffb7238e7cb5daa782ca7d (diff)
require Arch to have addresses that can += and -=, as well as that instructions have a debug display
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files 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<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;
}