From 7105805ba257072c3db03dd9c151739515fb76ed Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 19 Sep 2022 21:02:43 +0200 Subject: [PATCH] Extend from_fn_with_state doctest (#1393) --- axum/src/middleware/from_fn.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/axum/src/middleware/from_fn.rs b/axum/src/middleware/from_fn.rs index ac22bec1..7fb93474 100644 --- a/axum/src/middleware/from_fn.rs +++ b/axum/src/middleware/from_fn.rs @@ -117,11 +117,14 @@ pub fn from_fn(f: F) -> FromFnLayer { /// /// async fn my_middleware( /// State(state): State, +/// // you can add more extractors here... /// req: Request, /// next: Next, /// ) -> Response { -/// // ... -/// # ().into_response() +/// // do something with `req`... +/// let res = next.run(req).await; +/// // do something with `res`... +/// res /// } /// /// let state = AppState { /* ... */ };