diff --git a/src/emu/mem.rs b/src/emu/mem.rs index ebb14b5..b27ae1a 100644 --- a/src/emu/mem.rs +++ b/src/emu/mem.rs @@ -15,7 +15,7 @@ impl RamMemory { pub fn try_new() -> EmulatorResult { let alloc_result = vec![0; MEM_LENGTH].into_boxed_slice(); let data = alloc_result.try_into().map_err(|err|{ - EmulatorError::AllocationError(RAM,"Allocation failed") + EmulatorError::AllocationFailure(RAM, "Allocation failed") })?; Ok(RamMemory { data @@ -27,13 +27,13 @@ impl RamMemory { impl Memory for RamMemory { fn try_get_byte(&self, address: u32) -> EmulatorResult { log::trace!("Fetch RAM memory at address {}",address); - let x = *self.data.get(address as usize).ok_or(EmulatorError::UnreachableMemoryError(RAM,address))?; + let x = *self.data.get(address as usize).ok_or(EmulatorError::UnreachableMemory(RAM, address))?; Ok(x) } fn try_set_byte(&mut self, address: u32, value: u8) -> EmulatorResult<()> { if address>= MEM_LENGTH as u32 { - return Err(EmulatorError::UnreachableMemoryError(RAM,address)) + return Err(EmulatorError::UnreachableMemory(RAM, address)) } self.data[address as usize] = value; Ok(()) diff --git a/src/emu/mmu.rs b/src/emu/mmu.rs index 56ee6f5..b00815f 100644 --- a/src/emu/mmu.rs +++ b/src/emu/mmu.rs @@ -2,7 +2,7 @@ use crate::emu::iomem::MemoryMappedIO; use crate::emu::mem::RamMemory; use crate::misc::emulator_error::DeviceType::MMU; -use crate::misc::emulator_error::EmulatorError::UnreachableMemoryError; +use crate::misc::emulator_error::EmulatorError::UnreachableMemory; use crate::misc::result::EmulatorResult; // 8 bytes that are memory mapped i/o @@ -44,7 +44,7 @@ impl Memory for MappedMemory { RAM_MEM_START..=RAM_MEM_END => { self.ram_memory.try_get_byte(address) } - _ => { Err(UnreachableMemoryError(MMU, address)) } + _ => { Err(UnreachableMemory(MMU, address)) } }?; Ok(byte_at_addr) diff --git a/src/graphics/color.rs b/src/graphics/color.rs index ea7c424..eddd709 100644 --- a/src/graphics/color.rs +++ b/src/graphics/color.rs @@ -19,7 +19,7 @@ impl Color { } pub fn try_new(in_mem_color: u8) -> EmulatorResult { if in_mem_color > Self::COLOR_MAX { - return Err(EmulatorError::InvalidColorError(in_mem_color)) + return Err(EmulatorError::InvalidColor(in_mem_color)) } Ok(Color(in_mem_color)) } diff --git a/src/misc/emulator_error.rs b/src/misc/emulator_error.rs index ee1e3b8..b67e0b9 100644 --- a/src/misc/emulator_error.rs +++ b/src/misc/emulator_error.rs @@ -11,9 +11,9 @@ pub enum DeviceType { #[derive(Debug)] pub enum EmulatorError { - AllocationError(DeviceType, &'static str), - UnreachableMemoryError(DeviceType, u32), - InvalidColorError(u8) + AllocationFailure(DeviceType, &'static str), + UnreachableMemory(DeviceType, u32), + InvalidColor(u8) }