better structure + no need for lifetime specifier in Error. TODO: figure out better name for aforementioned
This commit is contained in:
+6
-6
@@ -63,12 +63,12 @@ impl fmt::Display for AccessType {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum Type<'a> {
|
||||
UnhandledInstruction(&'a str, Instruction),
|
||||
pub enum Type {
|
||||
UnhandledInstruction(&'static str, Instruction),
|
||||
UnhandledMemoryAccess(u32, AccessType),
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for Type<'a> {
|
||||
impl<'a> fmt::Display for Type {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let err_type = match self {
|
||||
Type::UnhandledInstruction(which_type, instr) => {
|
||||
@@ -84,12 +84,12 @@ impl<'a> fmt::Display for Type<'a> {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Error<'a> {
|
||||
pub struct Error {
|
||||
pub severity: Severity,
|
||||
pub err_type: Type<'a>,
|
||||
pub err_type: Type,
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for Error<'a> {
|
||||
impl<'a> fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "[{}]: {}", self.severity, self.err_type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user