[−][src]Struct pir_8_emu::vm::Memory
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]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<Range<u16>> for Memory
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, index: Range<u16>) -> &Self::Output
[src]
impl Index<RangeFrom<u16>> for Memory
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeFrom<u16>) -> &Self::Output
[src]
impl Index<RangeFull> for Memory
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeFull) -> &Self::Output
[src]
impl Index<RangeInclusive<u16>> for Memory
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeInclusive<u16>) -> &Self::Output
[src]
impl Index<RangeTo<u16>> for Memory
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeTo<u16>) -> &Self::Output
[src]
impl Index<RangeToInclusive<u16>> for Memory
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeToInclusive<u16>) -> &Self::Output
[src]
impl Index<u16> for Memory
[src]
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]
fn index_mut(&mut self, index: RangeInclusive<u16>) -> &mut Self::Output
[src]
impl IndexMut<RangeTo<u16>> for Memory
[src]
impl IndexMut<RangeToInclusive<u16>> for Memory
[src]
fn index_mut(&mut self, index: RangeToInclusive<u16>) -> &mut Self::Output
[src]
impl IndexMut<u16> for Memory
[src]
impl Ord for Memory
[src]
fn cmp(&self, other: &Memory) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,