use crate::Result; use crate::net; pub struct State { leash: net::Leash, pub store: store::Store, } pub fn new() -> Result { let state = State { leash: net::Leash::new(), store: store::open()?, }; state.store.namespaces().define("name")?; Ok(state) } pub fn new_test(path: &str) -> Result { let state = State { leash: net::Leash::new(), store: store::open_test(path)?, }; state.store.namespaces().define("name")?; Ok(state) } impl State { pub fn leash(&self) -> &net::Leash { &self.leash } }