pub struct SaveState {
pub version: u16,
pub globals: BTreeMap<String, Value>,
pub visits: Vec<VisitEntry>,
pub turns: Vec<VisitEntry>,
pub turn_index: u32,
pub rng_seed: i32,
pub previous_random: i32,
}Expand description
A persistent, name-keyed snapshot of a story’s game state.
Globals are keyed by variable name; visit/turn counts by scope
DefinitionId (which serializes as a stable "$tt_hash" string), with an
advisory author path attached when the scope is named.
Fields§
§version: u16Save-format version (see SAVE_FORMAT_VERSION).
globals: BTreeMap<String, Value>Global variables by name. BTreeMap for deterministic serialization.
visits: Vec<VisitEntry>Visit counts by scope id, sorted by id for deterministic output.
turns: Vec<VisitEntry>Turn-since counts by scope id, sorted by id.
turn_index: u32Global turn index.
rng_seed: i32RNG seed.
previous_random: i32Last drawn random value (so the RNG sequence resumes correctly).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SaveState
impl<'de> Deserialize<'de> for SaveState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SaveState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SaveState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SaveState
impl Serialize for SaveState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for SaveState
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