Change Router::with_state and impl Service for Router<()> (#1552)

* Implement `Service` for `Router<(), B>`

* wip

* wip

* fix some tests

* fix examples

* fix doc tests

* clean up docs

* changelog

* fix

* also call `with_state` when converting `MethodRouter` into a `MakeService`

* suggestions from review
This commit is contained in:
David Pedersen
2022-11-24 14:43:10 +00:00
committed by GitHub
parent fde38f6618
commit 0b26411f39
45 changed files with 576 additions and 738 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ use std::{convert::Infallible, fmt, marker::PhantomData};
/// .route("/set", post(set_secret))
/// .route("/get", get(get_secret))
/// .with_state(state);
/// # let _: axum::routing::RouterService = app;
/// # let _: axum::Router = app;
/// ```
///
/// If you have been using `Arc<AppState>` you cannot implement `FromRef<Arc<AppState>> for Key`.
+1 -1
View File
@@ -86,7 +86,7 @@ use std::{convert::Infallible, fmt, marker::PhantomData};
/// .route("/sessions", post(create_session))
/// .route("/me", get(me))
/// .with_state(state);
/// # let _: axum::routing::RouterService = app;
/// # let _: axum::Router = app;
/// ```
/// If you have been using `Arc<AppState>` you cannot implement `FromRef<Arc<AppState>> for Key`.
/// You can use a new type instead: