fn parallel_weather(
    db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = AWError> {
    let fut_result = vec![
        Box::new(db::execute(&db, Queries::GetTopTenHottestYears)),
        Box::new(db::execute(&db, Queries::GetTopTenColdestYears)),
        Box::new(db::execute(&db, Queries::GetTopTenHottestMonths)),
        Box::new(db::execute(&db, Queries::GetTopTenColdestMonths)),
    ];

    join_all(fut_result)
        .map_err(AWError::from)
        .map(|result| HttpResponse::Ok().json(result))
}
/// Version 2: Calls 4 queries in parallel, as an asynchronous handler
/// Returning Error types turn into None values in the response
Version 2: Calls 4 queries in parallel, as an asynchronous handler
Returning Error types turn into None values in the response
Version 2 : Calls 4 queries in parallel as an asynchronous handler Returning Error types turn into None values in the response
fn parallel_weather(
    db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = AWError> {
    let fut_result = vec![
        Box::new(db::execute(&db, Queries::GetTopTenHottestYears)),
        Box::new(db::execute(&db, Queries::GetTopTenColdestYears)),
        Box::new(db::execute(&db, Queries::GetTopTenHottestMonths)),
        Box::new(db::execute(&db, Queries::GetTopTenColdestMonths)),
    ];
    join_all(fut_result)
        .map_err(AWError::from)
        .map(|result| HttpResponse::Ok().json(result))
}
fn parallel_weather ( db : web :: Data < Pool > , ) -> impl Future < Item = HttpResponse , Error = AWError > { let fut_result = vec ! [ Box new ( db execute ( db Queries GetTopTenHottestYears ) ) Box new ( db execute ( db Queries GetTopTenColdestYears ) ) Box new ( db execute ( db Queries GetTopTenHottestMonths ) ) Box new ( db execute ( db Queries GetTopTenColdestMonths ) ) ] ; join_all ( fut_result ) . map_err ( AWError :: from ) . map ( | result | HttpResponse :: Ok ( ) . json ( result ) ) }
Version 2: Calls 4 queries in parallel, as an asynchronous handler
Returning Error types turn into None values in the response
Version 2 : Calls 4 queries in parallel as an asynchronous handler Returning Error types turn into None values in the response
db
web::Data<Pool>