Changed param from array slice to implInterator on routes in builder
This commit is contained in:
parent
752d1a9d10
commit
aba28d1612
@ -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<Item = Router>) -> 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user