better structure + no need for lifetime specifier in Error. TODO: figure out better name for aforementioned

This commit is contained in:
2026-08-19 22:28:21 +02:00
parent dd38da6dea
commit 81590e5f83
5 changed files with 45 additions and 58 deletions
+6 -6
View File
@@ -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)
}