pub struct RamMemory {
pub data: Vec<u8>,
pub write: bool,
}Expand description
RAM memory.
Fields§
§data: Vec<u8>RAM memory content.
write: boolIf false the memory is read-only.
Any attempt from the system to write data will return an MemoryAccessError::ReadOnly error.
Implementations§
Source§impl RamMemory
impl RamMemory
Sourcepub fn new_zero(size: usize) -> RamMemory
pub fn new_zero(size: usize) -> RamMemory
Creates a new RAM memory with size capacity, all bytes initialized to zero.
Sourcepub fn new_from_value(size: usize, value: u8) -> RamMemory
pub fn new_from_value(size: usize, value: u8) -> RamMemory
Creates a new RAM memory with size capacity, all bytes initialized to value.
Sourcepub fn new_from_slice(data: &[u8]) -> RamMemory
pub fn new_from_slice(data: &[u8]) -> RamMemory
Creates a new RAM memory with data as initial content. The size of the created memory is
the same as data.
Trait Implementations§
Source§impl MemoryInterface for RamMemory
impl MemoryInterface for RamMemory
fn size(&self) -> u32
fn read_u8(&mut self, address: u32, _env: &mut Env) -> MemoryReadResult<u8>
fn write_u8( &mut self, address: u32, value: u8, _env: &mut Env, ) -> MemoryWriteResult
fn read_u16le(&mut self, address: u32, env: &mut Env) -> MemoryReadResult<u16>
fn write_u16le( &mut self, address: u32, value: u16, env: &mut Env, ) -> MemoryWriteResult
fn read_u32le(&mut self, address: u32, env: &mut Env) -> MemoryReadResult<u32>
fn write_u32le( &mut self, address: u32, value: u32, env: &mut Env, ) -> MemoryWriteResult
fn update(&mut self, _env: &mut Env)
Auto Trait Implementations§
impl Freeze for RamMemory
impl RefUnwindSafe for RamMemory
impl Send for RamMemory
impl Sync for RamMemory
impl Unpin for RamMemory
impl UnwindSafe for RamMemory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more