1937 shaares
3 private links
3 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);