pub struct SaveState { /* private fields */ }Expand description
A captured snapshot of a System, ready to be encoded to bytes or
restored back into a running system.
Implementations§
Source§impl SaveState
impl SaveState
Sourcepub fn capture(system: &System, rom_tag: u64) -> Self
pub fn capture(system: &System, rom_tag: u64) -> Self
Captures system as a save-state tagged with rom_tag (an opaque
caller-supplied ROM identity, e.g. a hash of the loaded ROM image).
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, SaveStateError>
pub fn decode(bytes: &[u8]) -> Result<Self, SaveStateError>
Decodes a save-state from its binary wire format, without checking it
against any particular ROM yet (see Self::restore for that).
Sourcepub fn restore(bytes: &[u8], rom_tag: u64) -> Result<System, SaveStateError>
pub fn restore(bytes: &[u8], rom_tag: u64) -> Result<System, SaveStateError>
Decodes and validates a save-state against rom_tag, returning the
System it captured. Fails with SaveStateError::RomMismatch if
the save-state was captured for a different ROM.
Sourcepub fn into_system(self) -> System
pub fn into_system(self) -> System
The System this save-state captured, without any ROM-tag check —
for callers (like the rewind ring) that already know the ROM can’t
have changed since capture.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SaveState
impl<'de> Deserialize<'de> for SaveState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SaveState
impl RefUnwindSafe for SaveState
impl Send for SaveState
impl Sync for SaveState
impl Unpin for SaveState
impl UnsafeUnpin for SaveState
impl UnwindSafe for SaveState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more