Crates.io | jiden |
lib.rs | jiden |
version | 0.1.1 |
source | src |
created_at | 2024-03-21 17:33:08.610909 |
updated_at | 2024-03-21 22:22:38.126022 |
description | Save and retrive state and progress through a system file |
homepage | |
repository | https://gitlab.com/adhami3310/jiden |
max_upload_size | |
id | 1181895 |
size | 5,248 |
Save and retrive state and progress through a system file
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));
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());