Trait light_magic::atomic::DataStore
source · pub trait DataStore: Default + Serialize {
// Provided methods
fn open<P>(db: P) -> AtomicDatabase<Self>
where P: AsRef<Path>,
Self: DeserializeOwned { ... }
fn open_in_memory() -> AtomicDatabase<Self>
where Self: DeserializeOwned { ... }
fn load(file: impl Read) -> Result<Self>
where Self: Sized + DeserializeOwned { ... }
fn save(&self, file: impl Write) -> Result<()> { ... }
}Expand description
Trait DataStore that requires a few implementations. The defined functions have default definitions.
Provided Methods§
sourcefn open<P>(db: P) -> AtomicDatabase<Self>
fn open<P>(db: P) -> AtomicDatabase<Self>
Opens a Database by the specified path. If the Database doesn’t exist, this will create a new one! Wrap a Arc<_> around it to use it in parallel contexts!
sourcefn open_in_memory() -> AtomicDatabase<Self>where
Self: DeserializeOwned,
fn open_in_memory() -> AtomicDatabase<Self>where
Self: DeserializeOwned,
Creates a Database instance in memory. Wrap a Arc<_> around it to use it in parallel contexts!
Object Safety§
This trait is not object safe.