common: use prelude in all files
This commit is contained in:
@@ -1,9 +1,4 @@
|
|||||||
use crate::common::instructions::{
|
use crate::common::{instructions::encode::Encode, prelude::*};
|
||||||
args::{ITypeArgs, RTypeArgs},
|
|
||||||
encode::Encode,
|
|
||||||
errors::InstructionDecodeError,
|
|
||||||
errors::RegisterParseError,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Interrupt {
|
pub enum Interrupt {
|
||||||
@@ -408,3 +403,6 @@ impl TryFrom<u32> for Instruction {
|
|||||||
pub mod args;
|
pub mod args;
|
||||||
mod encode;
|
mod encode;
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
//! Various types of arguments that instructions can take, alongside encoding and decoding logic.
|
//! Various types of arguments that instructions can take, alongside encoding and decoding logic.
|
||||||
|
|
||||||
use crate::common::instructions::{RegisterParseError, encode::Encode};
|
use crate::common::instructions::Encode;
|
||||||
|
use crate::common::prelude::*;
|
||||||
use super::Register;
|
|
||||||
|
|
||||||
/// A list of errors that can be returned when decoding instruction arguments.
|
/// A list of errors that can be returned when decoding instruction arguments.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
use crate::common::instructions::Register;
|
use crate::common::prelude::*;
|
||||||
|
|
||||||
use super::Instruction;
|
|
||||||
|
|
||||||
/// Not to be used directly, just call [`Instruction::encode`].
|
/// Not to be used directly, just call [`Instruction::encode`].
|
||||||
pub trait Encode {
|
pub trait Encode {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! All the errors that may be returned from [`instructions`].
|
//! All the errors that may be returned from [`instructions`].
|
||||||
|
|
||||||
use super::args::ArgsDecodeError;
|
use crate::common::prelude::*;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
/// Error type for parsing register numbers.
|
/// Error type for parsing register numbers.
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
use crate::common::instructions::args::{ITypeArgs, RTypeArgs};
|
use crate::common::prelude::*;
|
||||||
|
|
||||||
use super::instructions::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_opcode_nop() {
|
fn test_opcode_nop() {
|
||||||
+6
-2
@@ -1,4 +1,8 @@
|
|||||||
pub mod instructions;
|
pub mod instructions;
|
||||||
|
|
||||||
#[cfg(test)]
|
pub mod prelude {
|
||||||
mod tests;
|
//! 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,4 +1,4 @@
|
|||||||
use crate::common::instructions::{Address, Interrupt, Register};
|
use crate::common::prelude::*;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
||||||
pub enum Running {
|
pub enum Running {
|
||||||
|
|||||||
Reference in New Issue
Block a user