use sled::Tree; use std::path::Path; const DB_DIR: &str = "db"; const DB_NAME_ADS: &str = "ads"; #[derive(Clone)] pub struct Dbs { pub ads: Tree, } pub fn load_dbs(path: &Path) -> Dbs { let db = sled::open(path.join(DB_DIR)).expect("Cannot open db"); Dbs { ads: db.open_tree(DB_NAME_ADS).unwrap(), } }