pub struct AppState { mp_tracks: Vec, p_tracks: Vec, } impl AppState { async fn try_new() -> Self { Self { mp_tracks: serde_json::from_str( &std::fs::read_to_string("content/mp-tracks.json") .expect("mp-tracks.json non trouvé"), ) .expect("JSON invalide"), p_tracks: serde_json::from_str( &std::fs::read_to_string("content/p-tracks.json") .expect("p-tracks.json non trouvé"), ) .expect("JSON invalide"), } } }