[][src]Struct cpclib_sna::Snapshot

pub struct Snapshot {
    pub debug: bool,
    // some fields omitted
}

Snapshot V3 representation. Can be saved in snapshot V1 or v2.

Fields

debug: bool

Methods

impl Snapshot[src]

pub fn log<S: Display>(&self, msg: S)[src]

pub fn load<P: AsRef<Path>>(filename: P) -> Self[src]

pub fn memory_size_header(&self) -> u16[src]

pub fn version_header(&self) -> u8[src]

pub fn fix_version(&self, version: SnapshotVersion) -> Self[src]

Create a new snapshot that contains only information understandable by the required version TODO return an error in case of failure instead of panicing

pub fn nb_chunks(&self) -> usize[src]

pub fn save_sna<P: AsRef<Path>>(&self, fname: P) -> Result<(), Error>[src]

Deprecated

Save the snapshot V3 on disc

pub fn save<P: AsRef<Path>>(
    &self,
    fname: P,
    version: SnapshotVersion
) -> Result<(), Error>
[src]

pub fn write(
    &self,
    buffer: &mut File,
    version: SnapshotVersion
) -> Result<(), Error>
[src]

pub fn memory_dump(&self) -> Vec<u8>[src]

Returns all the memory of the snapshot in a linear way by mixing both the hardcoded memory of the snapshot and the memory of chunks

pub fn has_memory_chunk(&self) -> bool[src]

Check if the snapshot has some memory chunk

pub fn memory_block(&self) -> &SnapshotMemory[src]

Returns the memory that is hardcoded in the snapshot

pub fn add_file(
    &mut self,
    fname: &str,
    address: usize
) -> Result<(), SnapshotError>
[src]

Add the content of a file at the required position

pub fn add_data(
    &mut self,
    data: &[u8],
    address: usize
) -> Result<(), SnapshotError>
[src]

Add the memory content at the required posiiton

use cpclib_sna::Snapshot;

let mut sna = Snapshot::default();
let data = vec![0,2,3,5];
sna.add_data(&data, 0x4000);

pub fn set_memory(&mut self, address: u32, value: u8)[src]

Change a memory value. Panic if memory size is not appropriate If memory is saved insided chuncks, the chuncks are unwrapped

pub fn set_value(
    &mut self,
    flag: SnapshotFlag,
    value: u16
) -> Result<(), SnapshotError>
[src]

Change the value of a flag

pub fn get_value(&self, flag: &SnapshotFlag) -> FlagValue[src]

pub fn print_info(&self)[src]

Trait Implementations

impl Clone for Snapshot[src]

impl Debug for Snapshot[src]

impl Default for Snapshot[src]

Auto Trait Implementations

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> 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.