Trait mem::MemoryBlock
[−]
[src]
pub trait MemoryBlock { fn get_size(&self) -> Addr; fn set(&mut self, _: Addr, _: Byte) -> Result<(), Error>; fn get(&self, _: Addr) -> Result<Byte, Error>; fn delete(&mut self, from: Addr, to: Addr) -> Result<(), Error> { ... } fn flush(&mut self) -> Result<(), Error> { ... } }
Simple trait for a finite memory block.
Required Methods
fn get_size(&self) -> Addr
Get the block's accessible size. Simply the highest address, NOT the number of addresses.
fn set(&mut self, _: Addr, _: Byte) -> Result<(), Error>
Set a byte at address.
fn get(&self, _: Addr) -> Result<Byte, Error>
Get a byte at address.
Returns Ok(X)
on success, where X will be the byte.
Provided Methods
fn delete(&mut self, from: Addr, to: Addr) -> Result<(), Error>
Delete data at address. May allow the block to efficiently delete it, marking it as unused. This could allow the block to do wear leveling, for example.
fn flush(&mut self) -> Result<(), Error>
Flush writes out. In case it does any form of caching, calling this method ensures it has written all the data it needs to write. Or, well, it fails otherwise.
Implementors
impl MemoryBlock for MemVector
impl<M: MemoryBlock> MemoryBlock for ReadOnly<M>