1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use super::Configurable;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Context<Cnf: Configurable> {
pub settings: Cnf,
}
impl<Cnf: Configurable> Context<Cnf> {
pub fn new(settings: Cnf) -> Self {
Self { settings }
}
}
impl<Cnf: Configurable> std::fmt::Display for Context<Cnf> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string_pretty(&self).unwrap())
}
}