Mount and other middleware's, how to chain them?
- Dominant language
- Rust
- Stars
- 50
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
It doesn't support Chain, right? So there's no way to do this or something like this?
```
env_logger::init().unwrap();
let mut hbse = HandlebarsEngine::new();
hbse.add(Box::new(DirectorySource::new("./views/", ".hbs")));
if let Err(r) = hbse.reload() {
panic!("{}", r.description());
}
let mut router = Router::new();
router.get("/", index);
let mut chain = Chain::new(router);
chain.link_after(hbse);
let mut mount = Mount::new();
mount
.mount("/", router)
.mount("/css/", Static::new(Path::new("static/css/")))
.mount("/js/", Static::new(Path::new("static/js/")))
.mount("/img/", Static::new(Path::new("static/img/")));
chain.link_after(mount); // --- compile error
println!("Server running at http://localhost:3000/");
Iron::new(mount).http("localhost:3000").unwrap();
```
The error is:
```
error: the trait `for<'r, 'r, 'r> core::ops::Fn<(&'r mut iron::request::Request<'r, 'r>, iron::response::Response)>` is not implemented for the type `mount::mount::Mount` [E0277]
src/main.rs:58 chain.link_after(mount);
```
Is other words, I want to get Mount to work with other middleware's. How can I do this?
Contributor guide
Assessment
This issue has not been assessed yet.