From 9cc2cea743b147bfb218727779b6c4ddcd8b8008 Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 10 Feb 2021 14:23:19 -0600 Subject: [PATCH] Update to actix-web 4 beta 3 --- Cargo.toml | 11 +++++------ examples/upload.rs | 3 +-- src/middleware.rs | 14 ++++++-------- src/types.rs | 2 +- src/upload.rs | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2aad3f5..fbf2696 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "actix-form-data" description = "Multipart Form Data for Actix Web" -version = "0.5.0" +version = "0.6.0-beta.1" license = "GPL-3.0" authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/actix-form-data.git" @@ -10,14 +10,13 @@ keywords = ["actix", "form-data", "multipart", "async"] edition = "2018" [dependencies] -actix-multipart = "0.3.0" -actix-rt = "1.1.1" -actix-web = "3.0.1" -bytes = "0.5.0" +actix-multipart = "0.4.0-beta.2" +actix-rt = "2.0.2" +actix-web = "4.0.0-beta.3" futures = "0.3.4" mime = "0.3.16" thiserror = "1.0" -tokio = { version = "0.2.21", features = ["sync"] } +tokio = { version = "1", features = ["sync"] } tracing = "0.1.15" [dev-dependencies] diff --git a/examples/upload.rs b/examples/upload.rs index 89235aa..1b48c85 100644 --- a/examples/upload.rs +++ b/examples/upload.rs @@ -2,10 +2,9 @@ use actix_form_data::{Error, Field, Form, Value}; use actix_web::{ http::StatusCode, middleware::Logger, - web::{post, resource}, + web::{post, resource, Bytes}, App, HttpResponse, HttpServer, ResponseError, }; -use bytes::Bytes; use futures::stream::{Stream, StreamExt, TryStreamExt}; use std::{ env, diff --git a/src/middleware.rs b/src/middleware.rs index 7265537..442c075 100644 --- a/src/middleware.rs +++ b/src/middleware.rs @@ -58,12 +58,11 @@ impl FromRequest for Value { } } -impl Transform for Form +impl Transform for Form where - S: Service, + S: Service, S::Future: 'static, { - type Request = S::Request; type Response = S::Response; type Error = S::Error; type InitError = (); @@ -78,21 +77,20 @@ where } } -impl Service for MultipartMiddleware +impl Service for MultipartMiddleware where - S: Service, + S: Service, S::Future: 'static, { - type Request = S::Request; type Response = S::Response; type Error = S::Error; type Future = Pin>>>; - fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { + fn poll_ready(&self, cx: &mut Context<'_>) -> Poll> { self.service.poll_ready(cx) } - fn call(&mut self, mut req: S::Request) -> Self::Future { + fn call(&self, mut req: ServiceRequest) -> Self::Future { let (tx, rx) = channel(); req.extensions_mut().insert(Uploaded { rx }); let payload = req.take_payload(); diff --git a/src/types.rs b/src/types.rs index acfb1c9..a35be65 100644 --- a/src/types.rs +++ b/src/types.rs @@ -18,7 +18,7 @@ */ use crate::Error; -use bytes::Bytes; +use actix_web::web::Bytes; use futures::Stream; use mime::Mime; use std::{ diff --git a/src/upload.rs b/src/upload.rs index baeda8b..f753110 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -24,7 +24,7 @@ use crate::{ MultipartForm, MultipartHash, NamePart, Value, }, }; -use bytes::BytesMut; +use actix_web::web::BytesMut; use futures::{ select, stream::{FuturesUnordered, StreamExt},