summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTimo Kösters <timo@koesters.xyz>2022-09-07 13:25:51 +0200
committerNyaaori <+@nyaaori.cat>2022-10-10 13:54:00 +0200
commitbd8b616ca01983b5f029095e168146693ffe9dcd (patch)
treed0b8fcbc0fce57ddaefa90f2ccefc843485624be /src/lib.rs
parent785ddfc4aae1ccd5e8ef8b796bb634b876e14cf8 (diff)
downloadconduit-bd8b616ca01983b5f029095e168146693ffe9dcd.zip
Fixed more compile time errors
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0d058df..c6e6569 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,7 +13,7 @@ mod service;
pub mod api;
mod utils;
-use std::cell::Cell;
+use std::{cell::Cell, sync::RwLock};
pub use config::Config;
pub use utils::error::{Error, Result};
@@ -22,13 +22,13 @@ pub use api::ruma_wrapper::{Ruma, RumaResponse};
use crate::database::KeyValueDatabase;
-pub static SERVICES: Cell<Option<ServicesEnum>> = Cell::new(None);
+pub static SERVICES: RwLock<Option<ServicesEnum>> = RwLock::new(None);
enum ServicesEnum {
Rocksdb(Services<KeyValueDatabase>)
}
-pub fn services() -> Services {
- SERVICES.get().unwrap()
+pub fn services() -> Services<KeyValueDatabase> {
+ SERVICES.read().unwrap()
}