2022-10-05 20:34:31 +02:00
|
|
|
pub mod api;
|
2022-09-25 10:59:19 +02:00
|
|
|
pub mod clap;
|
2022-02-03 13:30:04 +01:00
|
|
|
mod config;
|
2020-07-25 23:08:00 -04:00
|
|
|
mod database;
|
2022-09-06 23:15:09 +02:00
|
|
|
mod service;
|
2020-07-25 23:08:00 -04:00
|
|
|
mod utils;
|
|
|
|
|
2024-03-05 20:00:22 +00:00
|
|
|
// Not async due to services() being used in many closures, and async closures are not stable as of writing
|
2024-03-05 14:22:54 +00:00
|
|
|
// This is the case for every other occurence of sync Mutex/RwLock, except for database related ones, where
|
2024-03-05 20:31:40 +00:00
|
|
|
// the current maintainer (Timo) has asked to not modify those
|
2022-10-08 13:03:07 +02:00
|
|
|
use std::sync::RwLock;
|
2022-01-18 21:04:44 +01:00
|
|
|
|
2022-10-05 20:34:31 +02:00
|
|
|
pub use api::ruma_wrapper::{Ruma, RumaResponse};
|
2022-02-03 13:30:04 +01:00
|
|
|
pub use config::Config;
|
2022-10-08 13:03:07 +02:00
|
|
|
pub use database::KeyValueDatabase;
|
2022-10-05 20:34:31 +02:00
|
|
|
pub use service::{pdu::PduEvent, Services};
|
2022-09-06 23:15:09 +02:00
|
|
|
pub use utils::error::{Error, Result};
|
|
|
|
|
2022-10-05 15:33:57 +02:00
|
|
|
pub static SERVICES: RwLock<Option<&'static Services>> = RwLock::new(None);
|
2022-09-06 23:15:09 +02:00
|
|
|
|
2022-11-21 09:51:39 +01:00
|
|
|
pub fn services() -> &'static Services {
|
2022-10-10 14:09:11 +02:00
|
|
|
SERVICES
|
2022-10-05 20:34:31 +02:00
|
|
|
.read()
|
|
|
|
.unwrap()
|
|
|
|
.expect("SERVICES should be initialized when this is called")
|
2022-09-06 23:15:09 +02:00
|
|
|
}
|