use crate::config::Settings;
#[derive(
Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, serde::Deserialize, serde::Serialize,
)]
#[serde(rename_all = "snake_case", deny_unknown_fields)]
pub struct Context {
pub(crate) settings: Settings,
}
impl Context {
pub fn new() -> Self {
let settings = Settings::build().unwrap_or_default();
Self { settings }
}
pub const fn from_config(settings: Settings) -> Self {
Self { settings }
}
pub const fn settings(&self) -> &Settings {
&self.settings
}
pub fn settings_mut(&mut self) -> &mut Settings {
&mut self.settings
}
}