actix-web

Actix-Web reports “App data is not configured” when processing a file upload

…衆ロ難τιáo~ 提交于 2019-12-23 15:44:50
问题 I'm using the Actix framework to create a simple server and I've implemented a file upload using a simple HTML frontend. use actix_web::web::Data; use actix_web::{middleware, web, App, HttpResponse, HttpServer}; use std::cell::Cell; // file upload functions, the same as you can find it under the // actix web documentation: // https://github.com/actix/examples/blob/master/multipart/src/main.rs : mod upload; fn index() -> HttpResponse { let html = r#"<html> <head><title>Upload Test</title><

How do I convert an async / standard library future to futures 0.1?

妖精的绣舞 提交于 2019-12-11 15:41:53
问题 I want to use the async function to parse the inbound stream progressively, but actix-web requires impl Future<Item = HttpResponse, Error = Error> as the return value. How can I convert the future returned by async function to what actix-web requires? I'm using Rust 1.39 nightly and actix-web 1.0.7. http_srv.rs : use futures::compat::Stream01CompatExt; use futures::future::{FutureExt, TryFutureExt}; use futures::stream::TryStreamExt; use futures01::future::Future; use futures01::stream: