common: use prelude in all files

This commit is contained in:
2025-06-15 16:02:46 +01:00
parent 423d768e40
commit bffdf8c7bc
7 changed files with 16 additions and 19 deletions
+4 -6
View File
@@ -1,9 +1,4 @@
use crate::common::instructions::{
args::{ITypeArgs, RTypeArgs},
encode::Encode,
errors::InstructionDecodeError,
errors::RegisterParseError,
};
use crate::common::{instructions::encode::Encode, prelude::*};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Interrupt {
@@ -408,3 +403,6 @@ impl TryFrom<u32> for Instruction {
pub mod args;
mod encode;
pub mod errors;
#[cfg(test)]
mod tests;
+2 -3
View File
@@ -1,8 +1,7 @@
//! Various types of arguments that instructions can take, alongside encoding and decoding logic.
use crate::common::instructions::{RegisterParseError, encode::Encode};
use super::Register;
use crate::common::instructions::Encode;
use crate::common::prelude::*;
/// A list of errors that can be returned when decoding instruction arguments.
#[derive(Debug)]
+1 -3
View File
@@ -1,6 +1,4 @@
use crate::common::instructions::Register;
use super::Instruction;
use crate::common::prelude::*;
/// Not to be used directly, just call [`Instruction::encode`].
pub trait Encode {
+1 -1
View File
@@ -1,6 +1,6 @@
//! All the errors that may be returned from [`instructions`].
use super::args::ArgsDecodeError;
use crate::common::prelude::*;
#[derive(Debug)]
/// Error type for parsing register numbers.
@@ -1,6 +1,4 @@
use crate::common::instructions::args::{ITypeArgs, RTypeArgs};
use super::instructions::*;
use crate::common::prelude::*;
#[test]
fn test_opcode_nop() {
+6 -2
View File
@@ -1,4 +1,8 @@
pub mod instructions;
#[cfg(test)]
mod tests;
pub mod prelude {
//! A collection of types you should definitely import when working with this crate.
pub use super::instructions::{
Address, Instruction, InstructionType, Interrupt, Register, args::*, errors::*,
};
}
+1 -1
View File
@@ -1,4 +1,4 @@
use crate::common::instructions::{Address, Interrupt, Register};
use crate::common::prelude::*;
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum Running {