2 releases
0.1.1 | Mar 21, 2024 |
---|---|
0.1.0 | Mar 21, 2024 |
#8 in #restart
29 downloads per month
6KB
81 lines
Jiden
Save and retrive state and progress through a system file
Examples
State Save
let state_saver = StateSaver::new("state.txt");
state_saver.save(&1);
assert_eq!(state_saver.state(), Some(1));
After restarting the application:
let state_saver = StateSaver::new("state.txt");
assert_eq!(state_saver.state(), Some(1));
Progress Save
let state_saver = ProgressSaver::new("state.txt");
state_saver.save(0, 1);
assert_eq!(HashMap::from([(0, 1)]), progress_saver.state());
After restarting the application:
let state_saver = ProgressSaver::new("state.txt");
assert_eq!(HashMap::from([(0, 1)]), progress_saver.state());
Dependencies
~0.5–1MB
~20K SLoC