async story in Rust is still rather new; the
language support is great, but some things is still not
standardized, so there are two main libraries providing run-time
and I/O support.
One is async-std and the other
That said, over to the alternatives:
One of the "flagships" for web apps served by Rust. Requires the unstable "nightly" compiler, but is aiming to work on stable rust from the upcoming rocket 0.5 release.
Combines typed arguments with annotations for binding url parameters, post data, etc.
Based on tokio and an "everything is a filter" philosophy. Filters collect arguments from e.g. the url or cookies, which they send on the the next filters, including the actual handler. So if the handler wants e.g. en integer from the url or a valid authenticated session from a cookie, it can take those as arguments and never get called if they are absent or invalid.
Uses the async-std family of async libraries.
Each handler get a "
Request<T>" from which
parameters can be extracted by name.
Maybe not as pure (and optimized) as the warp way, but on the
other hand it gives an easier way to handle special demands in
each handler, while keeping the most common way as simple as a
?" operator on the extractor.
T" can be uses for application struct, providing
access to a database pool or any other shared resources.
Each handler takes a
State and returns a
(State, Response) tuple.
The State provides access both to shared application data and to
Parameters are extracted by type, rather than by name, requiring
some rather verbose code while still having important name strings
hidden in a layer of abstraction.
Based on the Actix actor framework rather than async-std or tokio. Routing and parameter extraction is by name, similar to tide.
Annotation-driven in a way similar to Rocket, but has been
working on stable Rust for a long time.
On the other hand, it has not seen much recent activity and still
uses a version of tokio that predates the
async/await language support.
Iron and nickel
These two are pretty much abandoned today, but deserves a honorable mention for being two of the first frameworks to demonstrate the potential of Rust in a web server.
If I choose a framework for a serious project starting now, I choose either warp or tide. That may change in the future, but if it does I'm confident that the strict type checking in Rust will make it easy to switch.
Have I missed your favorite framework? Or is my preference just wrong? Please write a comment and tell me!