pzzld_server/platform/
initializer.rs

1/*
2    Appellation: initializer <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5use super::Platform;
6use crate::config::Settings;
7
8pub struct Initializer {
9    pub(crate) config: Settings,
10}
11
12impl Initializer {
13    pub fn new(config: Settings) -> Self {
14        Self { config }
15    }
16
17    pub fn with_tracing(self) -> Self {
18        self.config.init_tracing();
19        self
20    }
21
22    pub fn finish(self) -> Platform {
23        let inner = super::Context {
24            config: self.config,
25        };
26        Platform {
27            inner: std::sync::Arc::new(inner),
28        }
29    }
30}