use perkv::KV; use std::collections::HashMap; #[macro_use] extern crate serde_derive; /// A default value type to use with KV #[allow(missing_docs)] #[derive(Clone, Serialize, Deserialize, PartialEq, Debug)] pub enum Value { String(String), Int(i32), Float(f32), Map(HashMap), List(Vec), } fn main() { let cab_path = "./db.cab"; let test_store = KV::::new(cab_path).unwrap(); let _ = test_store.insert("key", &Value::String("value".to_string())); println!("{:?}", test_store.get("key").unwrap()); let _ = test_store.remove("key"); let _ = KV::::new(cab_path) .unwrap() .insert("key", &Value::String("value".to_string())); let _ = KV::::new(cab_path).unwrap().remove("key"); let _ = std::fs::remove_file(cab_path); }