pzzld_server/platform/interface/
inner.rs

1/*
2    Appellation: context <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5use crate::config::Settings;
6
7#[derive(Clone, Debug)]
8pub struct Context {
9    pub(crate) config: Settings,
10}
11
12impl Context {
13    pub fn new(config: Settings) -> Self {
14        Self { config }
15    }
16    getter! {
17        config: Settings
18    }
19
20    setwith! {
21        config: Settings
22    }
23}
24
25impl Default for Context {
26    fn default() -> Self {
27        Self {
28            config: Settings::default(),
29        }
30    }
31}
32
33impl axum::extract::FromRef<Context> for Settings {
34    fn from_ref(ctx: &Context) -> Self {
35        ctx.config.clone()
36    }
37}