easy_safe

Function create_or_load_late_save_map_env

Source
pub fn create_or_load_late_save_map_env(name: &str) -> LateSaveMapEnv
Expand description

creates a new map environment with the specified name that does not save everytime an operation is done on the map 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

ยงExamples

  use easy_safe::{create_or_load_late_save_map_env, LateSaveMapEnv};
  let mut  map_env: LateSaveMapEnv = create_or_load_late_save_map_env("somename");
  map_env.put("somekey", "somevalue");
  map_env.save();

  let mut  same_file_map_env: LateSaveMapEnv = create_or_load_late_save_map_env("somename");
  let also_the_value = same_file_map_env.get("somekey").unwrap();
  assert_eq!(also_the_value, "somevalue");