mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-19 15:33:17 +01:00
Extend from_fn_with_state doctest (#1393)
This commit is contained in:
parent
4ade706ab0
commit
7105805ba2
1 changed files with 5 additions and 2 deletions
|
@ -117,11 +117,14 @@ pub fn from_fn<F, T>(f: F) -> FromFnLayer<F, (), T> {
|
||||||
///
|
///
|
||||||
/// async fn my_middleware<B>(
|
/// async fn my_middleware<B>(
|
||||||
/// State(state): State<AppState>,
|
/// State(state): State<AppState>,
|
||||||
|
/// // you can add more extractors here...
|
||||||
/// req: Request<B>,
|
/// req: Request<B>,
|
||||||
/// next: Next<B>,
|
/// next: Next<B>,
|
||||||
/// ) -> Response {
|
/// ) -> Response {
|
||||||
/// // ...
|
/// // do something with `req`...
|
||||||
/// # ().into_response()
|
/// let res = next.run(req).await;
|
||||||
|
/// // do something with `res`...
|
||||||
|
/// res
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let state = AppState { /* ... */ };
|
/// let state = AppState { /* ... */ };
|
||||||
|
|
Loading…
Reference in a new issue