1use crate::{Config, Context, data::Store, routing::Router};
2use std::sync::Arc;
3
4pub struct App {
5 config: Config,
6 router: Arc<Router>,
7 store: Arc<Store>,
8}
9
10impl App {
11 pub fn new(config: Config, router: Router, store: Store) -> Self {
12 let router = Arc::new(router);
13 let store = Arc::new(store);
14 Self { config, router, store }
15 }
16
17 pub fn router(&self) -> Arc<Router> {
18 self.router.clone()
19 }
20}
21
22impl Context for App {
23 fn config(&self) -> &Config {
24 &self.config
25 }
26
27 fn router(&self) -> Arc<Router> {
28 self.router.clone()
29 }
30
31 fn store(&self) -> Arc<Store> {
32 self.store.clone()
33 }
34}