#[actix_rt::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(
|| App::new()
.service(web::resource("/").to(|| HttpResponse::Ok())))
.bind("127.0.0.1:59090")?
.run()
.await
}
in this code HttpServer takes a closure which it supposedly executes for each worker thread before starting the server. This requires all application data that would be inside the closure to be Send, Sync, Clone, Copy.
My question is, why not just accept App instead of || -> App ? What's the real difference?