Crates.io | easy_safe |
lib.rs | easy_safe |
version | 0.1.9 |
source | src |
created_at | 2022-08-07 18:34:55.620983 |
updated_at | 2022-08-15 08:36:11.928032 |
description | an easy way to save string values on disk, in short -string maps on disk- |
homepage | |
repository | https://github.com/SilenLoc/easy_safe |
max_upload_size | |
id | 640329 |
size | 28,732 |
An easy unstable crate to save strings into a map that is saved on the disk.
The normal map_env creates a new map environment with the specified name. The name corresponds to the file saved and loaded in your filesystem. If the file is already there it will load from that file.
This means you can always come back and access your file if you call it with the right name
Example
use easy_safe::{create_or_load_map_env, MapEnv};
let mut map_env: MapEnv = create_or_load_map_env("somename");
map_env.put("somekey", "somevalue");
let value = map_env.get("somekey").unwrap();
assert_eq!(value, "somevalue");
let mut same_file_map_env: MapEnv = create_or_load_map_env("somename");
let also_the_value = same_file_map_env.get("somekey").unwrap();
assert_eq!(value, "somevalue");