use crate::{Config, Context, data::Store, routing::Router};
use std::sync::Arc;
pub struct App {
config: Config,
router: Arc<Router>,
store: Arc<Store>,
}
impl App {
pub fn new(config: Config, router: Router, store: Store) -> Self {
let router = Arc::new(router);
let store = Arc::new(store);
Self { config, router, store }
}
pub fn router(&self) -> Arc<Router> {
self.router.clone()
}
}
impl Context for App {
fn config(&self) -> &Config {
&self.config
}
fn router(&self) -> Arc<Router> {
self.router.clone()
}
fn store(&self) -> Arc<Store> {
self.store.clone()
}
}