state.rs (406B)
1 use crate::config::Config; 2 use sqlx::PgPool; 3 use std::sync::Arc; 4 5 #[derive(Clone)] 6 pub struct AppState { 7 pub config: Arc<Config>, 8 pub pool: PgPool, 9 pub http_client: reqwest::Client, 10 } 11 12 impl AppState { 13 pub fn new(config: Config, pool: PgPool) -> Self { 14 Self { 15 config: Arc::new(config), 16 pool, 17 http_client: reqwest::Client::new(), 18 } 19 } 20 }