mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
refactor: switch from_fn to stable version
This commit is contained in:
@ -33,4 +33,4 @@ A minimal middleware demonstrating the sequence of operations in an actix middle
|
||||
|
||||
## See Also
|
||||
|
||||
- The `from_fn` middleware constructor from [`actix-web-lab`](https://crates.io/crates/actix-web-lab).
|
||||
- The [`from_fn` middleware constructor](https://docs.rs/actix-web/4/actix_web/middleware/fn.from_fn.html).
|
||||
|
@ -1,16 +1,18 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use actix_http::body::MessageBody;
|
||||
use actix_web::{dev, rt::time, web, App, Error, HttpServer};
|
||||
use actix_web_lab::middleware::{from_fn, Next};
|
||||
use actix_web::{
|
||||
body::MessageBody,
|
||||
dev,
|
||||
middleware::{from_fn, Next},
|
||||
rt::time,
|
||||
web, App, Error, HttpServer,
|
||||
};
|
||||
|
||||
mod read_request_body;
|
||||
mod read_response_body;
|
||||
mod redirect;
|
||||
mod simple;
|
||||
|
||||
// See more examples of from_fn middleware here:
|
||||
// https://github.com/robjtede/actix-web-lab/blob/main/actix-web-lab/examples/from_fn.rs
|
||||
async fn timeout_10secs(
|
||||
req: dev::ServiceRequest,
|
||||
next: Next<impl MessageBody + 'static>,
|
||||
|
Reference in New Issue
Block a user