[][src]Struct pir_8_emu::vm::Memory

pub struct Memory { /* fields omitted */ }

Mostly-transparent wrapper for a heap-allocated 64KiB u8 array with R/W tracking

Methods

impl Memory[src]

pub fn new() -> Memory[src]

Create fresh zero-initialised unread and unwritten memory

pub fn iter_rw(&self) -> MemoryReadWrittenIterator[src]

Get an iterator over the read and written memory cells

Examples

let mut memory = Memory::new();
memory[0x4B0B] = memory[0x00A1];
println!("{}", memory[0x4B0B]);
memory[0xEB0B] = 0x12;

// (address, value, was_read, was_written)
assert_eq!(memory.iter_rw().collect::<Vec<_>>(),
           &[(0x00A1, 0x00, true, false),
             (0x4B0B, 0x00, true, true),
             (0xEB0B, 0x12, false, true)]);

pub fn reset_rw(&mut self)[src]

Mark all of memory as unread and unwritten

Examples

let mut memory = Memory::new();
memory[0x4B0B] = memory[0x00A1];
println!("{}", memory[0x4B0B]);
memory[0xEB0B] = 0x12;

memory.reset_rw();
assert_eq!(memory.iter_rw().collect::<Vec<_>>(), &[]);

Trait Implementations

impl Clone for Memory[src]

impl Debug for Memory[src]

impl Default for Memory[src]

impl Eq for Memory[src]

impl<'_> From<&'_ [u8]> for Memory[src]

fn from(data: &[u8]) -> Memory[src]

Read as much data as possible from the specified buffer into this memory

impl Hash for Memory[src]

impl Index<Range<u16>> for Memory[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFrom<u16>> for Memory[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for Memory[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeInclusive<u16>> for Memory[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeTo<u16>> for Memory[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeToInclusive<u16>> for Memory[src]

type Output = [u8]

The returned type after indexing.

impl Index<u16> for Memory[src]

type Output = u8

The returned type after indexing.

impl IndexMut<Range<u16>> for Memory[src]

impl IndexMut<RangeFrom<u16>> for Memory[src]

impl IndexMut<RangeFull> for Memory[src]

impl IndexMut<RangeInclusive<u16>> for Memory[src]

impl IndexMut<RangeTo<u16>> for Memory[src]

impl IndexMut<RangeToInclusive<u16>> for Memory[src]

impl IndexMut<u16> for Memory[src]

impl Ord for Memory[src]

impl PartialEq<[u8]> for Memory[src]

impl PartialEq<Memory> for Memory[src]

impl PartialOrd<Memory> for Memory[src]

Auto Trait Implementations

impl RefUnwindSafe for Memory

impl Send for Memory

impl Sync for Memory

impl Unpin for Memory

impl UnwindSafe for Memory

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.