1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
pub struct Config { pub host: String, pub port: i32, pub addr: String, pub env: String, pub logging: bool, } impl Config { pub fn new(host: &str, port: i32) -> Self { let addr = format!("{}:{}", host, port); Self { host: host.to_string(), port: port, addr: addr, env: "development".to_string(), logging: true, } } }