1
0
mirror of https://github.com/actix/examples synced 2025-06-28 09:50:36 +02:00

rename web::State to web::Data

This commit is contained in:
Nikolay Kim
2019-03-16 20:23:09 -07:00
parent 14eed91fcd
commit b31c8e3308
8 changed files with 23 additions and 23 deletions

View File

@ -21,7 +21,7 @@ use db::{Pool, Queries, WeatherAgg};
/// Version 1: Calls 4 queries in sequential order, as an asynchronous handler
fn asyncio_weather(
db: web::State<Pool>,
db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = AWError> {
let mut result: Vec<Vec<WeatherAgg>> = vec![];
@ -52,7 +52,7 @@ fn asyncio_weather(
/// 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::State<Pool>,
db: web::Data<Pool>,
) -> impl Future<Item = HttpResponse, Error = AWError> {
let fut_result = vec![
Box::new(db::execute(&db, Queries::GetTopTenHottestYears)),