diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index 3ac176193..07fc00631 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -16,12 +16,12 @@ use percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; use v_htmlescape::escape as escape_html_entity; use actix_service::{boxed::BoxedNewService, NewService, Service}; -use actix_web::dev::{CpuFuture, HttpServiceFactory, ResourceDef, ServiceConfig}; -use actix_web::error::{BlockingError, Error, ErrorInternalServerError}; -use actix_web::{ - web, FromRequest, HttpRequest, HttpResponse, Responder, ServiceFromRequest, +use actix_web::dev::{ + CpuFuture, HttpServiceFactory, ResourceDef, ServiceConfig, ServiceFromRequest, ServiceRequest, ServiceResponse, }; +use actix_web::error::{BlockingError, Error, ErrorInternalServerError}; +use actix_web::{web, FromRequest, HttpRequest, HttpResponse, Responder}; use futures::future::{ok, FutureResult}; mod config; @@ -34,7 +34,8 @@ pub use crate::config::{DefaultConfig, StaticFileConfig}; pub use crate::named::NamedFile; pub use crate::range::HttpRange; -type HttpNewService
= BoxedNewService<(), ServiceRequest
, ServiceResponse, (), ()>; +type HttpNewService
= + BoxedNewService<(), ServiceRequest
, ServiceResponse, Error, ()>; /// Return the MIME type associated with a filename extension (case-insensitive). /// If `ext` is empty or no associated type for the extension was found, returns @@ -319,7 +320,7 @@ where impl
NewService for Files
{ type Request = ServiceRequest
; type Response = ServiceResponse; - type Error = (); + type Error = Error; type Service = FilesService
;
type InitError = ();
type Future = FutureResult Service for FilesService {
type Request = ServiceRequest ;
type Response = ServiceResponse;
- type Error = ();
+ type Error = Error;
type Future = FutureResult : Sized {
///
/// ```rust
/// # #[macro_use] extern crate serde_derive;
-/// use actix_web::{web, App, Error, FromRequest, ServiceFromRequest};
+/// use actix_web::{web, dev, App, Error, FromRequest};
/// use actix_web::error::ErrorBadRequest;
/// use rand;
///
@@ -53,7 +53,7 @@ pub trait FromRequest : Sized {
/// type Error = Error;
/// type Future = Result ) -> Self::Future {
+/// fn from_request(req: &mut dev::ServiceFromRequest ) -> Self::Future {
/// if rand::random() {
/// Ok(Thing { name: "thingy".into() })
/// } else {
@@ -107,7 +107,7 @@ where
///
/// ```rust
/// # #[macro_use] extern crate serde_derive;
-/// use actix_web::{web, App, Result, Error, FromRequest, ServiceFromRequest};
+/// use actix_web::{web, dev, App, Result, Error, FromRequest};
/// use actix_web::error::ErrorBadRequest;
/// use rand;
///
@@ -120,7 +120,7 @@ where
/// type Error = Error;
/// type Future = Result ) -> Self::Future {
+/// fn from_request(req: &mut dev::ServiceFromRequest ) -> Self::Future {
/// if rand::random() {
/// Ok(Thing { name: "thingy".into() })
/// } else {
{
impl