INNER CODE UNIT · Rust

insert

valeriansaliou/sonic · core/src/executor/mod.rs:59

    pub fn insert(&self, collection: &str, config: DynamicConfig) {
        (self.0.write().unwrap()).insert(StoreKeyerHasher::to_compact(collection), config);
    }

    pub fn get(&self, collection: &str) -> Option<DynamicConfig> {
        (self.0.read().unwrap())
            .get(&StoreKeyerHasher::to_compact(collection))
            .copied()
    }

    pub fn read<'a>(&'a self) -> DynamicConfigStoreReadGuard<'a> {
        DynamicConfigStoreReadGuard(self.0.read().unwrap())
    }
}

impl std::fmt::Debug for DynamicConfigStore {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        use crate::util::fmt::AsPrettyRwLock;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…