datasources 0.1.5

Async datasource interfaces, middleware, registry, and test doubles
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::driver::Driver;
use std::collections::HashMap;
use std::sync::{Arc, Mutex, MutexGuard};

pub struct FactoryPair {
    pub driver: Arc<dyn Driver>,
}

static REGISTRY: Mutex<Option<HashMap<String, FactoryPair>>> = Mutex::new(None);

pub(crate) fn registry() -> MutexGuard<'static, Option<HashMap<String, FactoryPair>>> {
    REGISTRY.lock().expect("registry")
}