Extend from_fn_with_state doctest (#1393)

This commit is contained in:
Jonas Platte 2022-09-19 21:02:43 +02:00 committed by GitHub
parent 4ade706ab0
commit 7105805ba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,11 +117,14 @@ pub fn from_fn<F, T>(f: F) -> FromFnLayer<F, (), T> {
///
/// async fn my_middleware<B>(
/// State(state): State<AppState>,
/// // you can add more extractors here...
/// req: Request<B>,
/// next: Next<B>,
/// ) -> Response {
/// // ...
/// # ().into_response()
/// // do something with `req`...
/// let res = next.run(req).await;
/// // do something with `res`...
/// res
/// }
///
/// let state = AppState { /* ... */ };