1974 shaares
6 private links
6 private links
struct UsersService {
config: &'static Config,
}
struct OrdersService {
config: &'static Config,
}
// ...
fn load() -> Result<&'static Config, Error> {
// ...
return Ok(Box::leak(Box::new(config)));
}
// ...
let config = config::load()?;
let users_service = UsersService::new(config);
let orders_service = OrdersService::new(config);