jsave
Persistent storage copy in JSON format for serializable in-memory data
Design
Just like RwLock
, jsave is a reader-writer lock, but serializes and saves data to a file in json format on every writing operation finish
Do not use it unless you only want to persist a tiny amount of data
Usage
use ;
use HashMap;
// Data to be persisted. Needs to be serializable and deserializable
let data = Data ;
use File;
// Create the file for storing the data
create.unwrap;
use Jsave;
// Initialize a new Jsave instance with the given data. Note that the file will be truncated
let db = init_with.unwrap;
drop;
// Initialize a new Jsave instance from a file
let db = init.unwrap;
let db_read = db.read;
println!;
License
GNU General Public License v3.0