pzzld-server 0.0.2

A production ready server optimized for WASM applications
Documentation
/*
    Appellation: context <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/
use crate::config::Settings;

#[derive(Clone, Debug)]
pub struct Context {
    pub(crate) config: Settings,
}

impl Context {
    pub fn new(config: Settings) -> Self {
        Self { config }
    }
    getter! {
        config: Settings
    }

    setwith! {
        config: Settings
    }
}

impl Default for Context {
    fn default() -> Self {
        Self {
            config: Settings::default(),
        }
    }
}

impl axum::extract::FromRef<Context> for Settings {
    fn from_ref(ctx: &Context) -> Self {
        ctx.config.clone()
    }
}