5 ms·
Copying my comment on this from Reddit: Great, I'll definitely have to try this! I've used several Rust web frameworks, including Iron[1], Nickel[2], and Rustf
by barosl 11y ago
Copying my comment on this from Reddit:
Great, I'll definitely have to try this! I've used several Rust web frameworks, including Iron[1], Nickel[2], and Rustful[3]. Each of them has their own strengths and weaknesses, so I've been launching new web sites using all of them to see what fits me best. (Until now, Rustful felt the most comfortable. But I like the others too!) Now I have one more thing to evaluate!
Before diving into this, one thing that caught me at a glance is the order of the arguments in the routing rules. It is using `/user/<int:user_id>`, but I think `/user/<user_id:int>` is more natural. A small difference, but I believe this is one thing that Bottle[4] did right. When types come later, it is easier to omit them if there's a default (e.g. `<username>` has the same meaning as `<username:str>`) and it is also consistent with the existing type annotation syntax of Rust. I suspect Flask uses the current order only because of the backward compatibility concerns. But only mitsuhiko can tell for sure.
Also, it would be great if `ViewFunc` is extended to accept the functions other than the ones returning `Result<Response, _>`, e.g. `Result<String, _>` and `Result<Vec<u8>, _>`. It is true that there exist the `From` implementations in `Response`, but it is generally more convenient to return `String` directly from the handlers rather than manually forming `Response::from("...")`. I think I can prepare a PR if you like!
Thanks again for another attempt to use Rust as a web language!
[1] http://ironframework.io/ http://ironframework.io/
[2] http://nickel.rs/ http://nickel.rs/
[3] https://github.com/Ogeon/rustful https://github.com/Ogeon/rustful
[4] http://bottlepy.org/ http://bottlepy.org/
- kibwen 11y agoFor those reading, note that mitsuhiko did end up responding to this on Reddit: https://www.reddit.com/r/rust/comments/49jv81/introducing_pencil_a_microframework_inspired_by/d0sku9f https://www.reddit.com/r/rust/comments/49jv81/introducing_pe...