jiden

Crates.iojiden
lib.rsjiden
version0.1.1
sourcesrc
created_at2024-03-21 17:33:08.610909
updated_at2024-03-21 22:22:38.126022
descriptionSave and retrive state and progress through a system file
homepage
repositoryhttps://gitlab.com/adhami3310/jiden
max_upload_size
id1181895
size5,248
Khaleel Al-Adhami (adhami3310)

documentation

README

Jiden

Crates.io Version

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());
Commit count: 7

cargo fmt