Skip to main content

Module state

Module state 

Source
Expand description

Generic JSON state persistence (load/save).

Provides load_state and save_state for any type that implements serde’s Serialize / DeserializeOwned. State files are written atomically (write to a temp file, then rename) so a crash mid-write never corrupts the on-disk state.

Functions§

load_state
Load state from a JSON file.
save_state
Save state to a JSON file atomically.