amethystate 0.9.1

Type-safe reactive persistence for Rust GUI apps
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::DefaultStore;

pub fn unique_store(suffix: &str) -> DefaultStore {
    use crate::store::config::StoreConfig;
    use std::time::{SystemTime, UNIX_EPOCH};

    let nanos = SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .unwrap()
        .as_nanos();
    let path = std::env::temp_dir().join(format!("amethystate-test-{suffix}-{nanos}.db"));

    DefaultStore::open(StoreConfig::new(path), Default::default())
        .unwrap()
        .0
}