use std::path::Path; use std::sync::Arc; #[derive(Clone)] pub struct Database(sled::Db); impl Database { pub fn start_default>(path: P) -> sled::Result { sled::Db::start_default(path).map(Database) } pub fn open_index(&self, name: &str) -> sled::Result { let name = format!("index-{}", name); let bytes = name.into_bytes(); self.0.open_tree(bytes).map(Index) } } #[derive(Debug, Clone)] pub struct Index(Arc);