Crate mem

Source
Expand description

§mem

A rather generic memory (block) interface. Use Mutexes if you need thread safety, this doesn’t provide any.

This crate is mainly for building emulators and such.

§But.. why?!

Because abstraction is great. Well, this is really just an abstraction around byte addressable storage. Doesn’t have to be RAM, could be a file or even a block device. Or some sort of remote memory interface. Or a live memory debugger/editor for an emulator! Let your imagination go wild! :)

Modules§

errors
Error module y u do this???
std_impls

Traits§

MemoryBlock
Simple trait for a finite memory block.
MemoryBlock32be
Subtrait for 32 bit big-endian interface
MemoryBlock32le
Subtrait for 32 bit little-endian interface
MemoryCreator
Simple new(size) trait for backends.
MemoryMiddlewareCreator
Trait for a new function that wraps another memory block, returning one itself.

Functions§

copy
Copy all of the src memory block to dst. Returns Ok(writtenbytes) to signify writtenbytes bytes have been copied, or Err(error) if some error happened during copying.
copy_at
Copy the contents of src at from to to to dst, starting at pos. Returns Ok(writtenbytes) to signify writtenbytes bytes have been copied, or Err(error) if some error happened during copying.

Type Aliases§

Addr
Address type/size. Just a simple alias to usize for easier-to-read code. (In my opinion, obviously.) Originally, I wanted to make it use generics, but that got messy really quick.
Byte
Byte. Convenience alias.