From aba28d1612961778782c9ab99cb72e4da626aca1 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Thu, 27 Jun 2024 00:12:47 +0200 Subject: [PATCH] Changed param from array slice to implInterator on routes in builder --- src/axum/app.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axum/app.rs b/src/axum/app.rs index 8c81e06..91e1557 100644 --- a/src/axum/app.rs +++ b/src/axum/app.rs @@ -42,8 +42,8 @@ impl AppBuilder { Self::default() } - pub fn routes(mut self, routes: &[Router]) -> Self { - self.router = routes.iter().cloned().fold(self.router, Router::merge); + pub fn routes(mut self, routes: impl IntoIterator) -> Self { + self.router = routes.into_iter().fold(self.router, Router::merge); self } @@ -147,7 +147,7 @@ mod tests { let handler = tokio::spawn(async { AppBuilder::new() .socket((Ipv4Addr::LOCALHOST, 8080)) - .routes(&[Router::new()]) + .routes([Router::new()]) .fallback(|| async { "Fallback" }) .cors(CorsLayer::new()) .normalize_path(true)