mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-22 00:00:17 +02:00
Further compile time improvements (#220)
This improves compiles further when using lots of nested routes. Such as the example posted [here](https://github.com/tokio-rs/axum/issues/200#issuecomment-902541073). It seems rustc is really slow at checking bounds on these kinds of intermediate builder methods. Should probably file an issue about that.
This commit is contained in:
+2
-8
@@ -119,10 +119,7 @@ impl<S> Router<S> {
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `description` doesn't start with `/`.
|
||||
pub fn route<T, B>(self, description: &str, svc: T) -> Router<Route<T, S>>
|
||||
where
|
||||
T: Service<Request<B>> + Clone,
|
||||
{
|
||||
pub fn route<T>(self, description: &str, svc: T) -> Router<Route<T, S>> {
|
||||
self.map(|fallback| Route {
|
||||
pattern: PathPattern::new(description),
|
||||
svc,
|
||||
@@ -207,10 +204,7 @@ impl<S> Router<S> {
|
||||
/// If necessary you can use [`Router::boxed`] to box a group of routes
|
||||
/// making the type easier to name. This is sometimes useful when working with
|
||||
/// `nest`.
|
||||
pub fn nest<T, B>(self, description: &str, svc: T) -> Router<Nested<T, S>>
|
||||
where
|
||||
T: Service<Request<B>> + Clone,
|
||||
{
|
||||
pub fn nest<T>(self, description: &str, svc: T) -> Router<Nested<T, S>> {
|
||||
self.map(|fallback| Nested {
|
||||
pattern: PathPattern::new(description),
|
||||
svc,
|
||||
|
||||
Reference in New Issue
Block a user