mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-11 12:31:25 +01:00
Export Or
in a more consistent way
This commit is contained in:
parent
570e13195c
commit
23dcf3631e
2 changed files with 8 additions and 5 deletions
|
@ -14,6 +14,8 @@ use tower::{
|
|||
BoxError, Service,
|
||||
};
|
||||
|
||||
pub use super::or::ResponseFuture as OrResponseFuture;
|
||||
|
||||
opaque_future! {
|
||||
/// Response future for [`EmptyRouter`](super::EmptyRouter).
|
||||
pub type EmptyRouterFuture<E> =
|
||||
|
|
|
@ -29,9 +29,9 @@ use tower::{
|
|||
use tower_http::map_response_body::MapResponseBodyLayer;
|
||||
|
||||
pub mod future;
|
||||
pub mod or;
|
||||
mod or;
|
||||
|
||||
pub use self::method_filter::MethodFilter;
|
||||
pub use self::{method_filter::MethodFilter, or::Or};
|
||||
|
||||
mod method_filter;
|
||||
|
||||
|
@ -479,7 +479,8 @@ impl<S> Router<S> {
|
|||
/// # async fn teams_list() {}
|
||||
///
|
||||
/// // define some routes separately
|
||||
/// let user_routes = Router::new().route("/users", get(users_list))
|
||||
/// let user_routes = Router::new()
|
||||
/// .route("/users", get(users_list))
|
||||
/// .route("/users/:id", get(users_show));
|
||||
///
|
||||
/// let team_routes = Router::new().route("/teams", get(teams_list));
|
||||
|
@ -490,8 +491,8 @@ impl<S> Router<S> {
|
|||
/// # hyper::Server::bind(&"".parse().unwrap()).serve(app.into_make_service()).await.unwrap();
|
||||
/// # };
|
||||
/// ```
|
||||
pub fn or<S2>(self, other: S2) -> Router<or::Or<S, S2>> {
|
||||
self.map(|first| or::Or {
|
||||
pub fn or<S2>(self, other: S2) -> Router<Or<S, S2>> {
|
||||
self.map(|first| Or {
|
||||
first,
|
||||
second: other,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue