From 957663f5d483b1abaa3f5af25e32c274218319d5 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Mon, 27 Feb 2023 21:00:26 +0100 Subject: Move prelude to crate level and make public --- src/insn.rs | 2 -- src/insn/mov.rs | 2 +- src/insn/prelude.rs | 6 ------ src/lib.rs | 11 ++--------- src/prelude.rs | 6 ++++++ tests/mov.rs | 4 +--- 6 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 src/insn/prelude.rs create mode 100644 src/prelude.rs diff --git a/src/insn.rs b/src/insn.rs index 7c74dd9..c0bcc4e 100644 --- a/src/insn.rs +++ b/src/insn.rs @@ -1,5 +1,3 @@ -mod prelude; - mod mov; pub trait Mov { diff --git a/src/insn/mov.rs b/src/insn/mov.rs index d930ade..bf1c33e 100644 --- a/src/insn/mov.rs +++ b/src/insn/mov.rs @@ -1,4 +1,4 @@ -use super::prelude::*; +use crate::prelude::*; // -- MOV : reg reg diff --git a/src/insn/prelude.rs b/src/insn/prelude.rs deleted file mode 100644 index 703417a..0000000 --- a/src/insn/prelude.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub use crate::Asm; -pub use crate::MemOp; -pub use crate::{Imm16, Imm32, Imm64, Imm8}; -pub use crate::{Reg16, Reg32, Reg64, Reg8}; - -pub use crate::insn::Mov; diff --git a/src/lib.rs b/src/lib.rs index 9eb2583..e38da14 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +pub mod prelude; + mod imm; mod insn; mod reg; @@ -7,8 +9,6 @@ pub use imm::{Imm16, Imm32, Imm64, Imm8}; use reg::Reg; pub use reg::{Reg16, Reg32, Reg64, Reg8}; -use insn::Mov; - pub enum MemOp { Indirect(Reg64), IndirectDisp(Reg64, i32), @@ -69,13 +69,6 @@ impl Asm { } } - pub fn mov(&mut self, op1: T, op2: U) - where - Self: Mov, - { - >::mov(self, op1, op2); - } - fn encode_rr(&mut self, opc: u8, op1: T, op2: T) where Self: EncodeRR, diff --git a/src/prelude.rs b/src/prelude.rs new file mode 100644 index 0000000..d1cd794 --- /dev/null +++ b/src/prelude.rs @@ -0,0 +1,6 @@ +pub use crate::Asm; +pub use crate::MemOp; +pub use crate::{Imm16, Imm32, Imm64, Imm8}; +pub use crate::{Reg16, Reg32, Reg64, Reg8}; + +pub use crate::insn::{Add, Mov}; diff --git a/tests/mov.rs b/tests/mov.rs index fce50a1..903bd5f 100644 --- a/tests/mov.rs +++ b/tests/mov.rs @@ -1,6 +1,4 @@ -use juicebox_asm::Asm; -use juicebox_asm::MemOp; -use juicebox_asm::{Imm16, Imm32, Imm64, Imm8}; +use juicebox_asm::prelude::*; use juicebox_asm::{Reg16::*, Reg32::*, Reg64::*, Reg8::*}; macro_rules! mov { -- cgit v1.2.3