We are pleased to announce the next major release for actix-web, v3.0! This is the safest, most stable version yet. We highly recommend everyone upgrade to v3 ASAP to benefit from these improvements. Further, v3 introduces several other improvements with minimal breaking changes.
This is a significant release for several reasons:
It is the first major release following changes in project leadership. The Actix ecosystem is now entirely community-driven, including a significant number of contributions from dozens of members of the Rust community. A big thanks to all the hands that helped make this release happen.
Actix-Web and its dependent crates in the actix-net repo are more stable than ever. Extensive usage of the projects helped us resolve memory leaks. Deep analysis of unsafe blocks helped pinpoint concerns of undefined behavior and every known concern was addressed for this release.
Ergonomics have improved. It’s easier to get going with a single actix_web = "3" import because now #[actix_web::main] will do the same as #[actix_rt::main] from v2. In fact, the entire runtime crate is re-exported as actix_web::rt, too.
Improvements to data containers: default services can now access app data, Resources and Scopes can access parent data while holding their own data, and ServiceRequest::app_data returns T instead of Data<T> which fully enables passing custom types between middleware, extractors and handlers.
Actix-web v3 is the most stable version yet. Stability has been significantly improved by reducing risk exposure to undefined behavior within unsafe implementation and by addressing memory leaks detected from production use.
Unsafe plays far less of a role now than it has in the past. Several contributors vetted unsafe blocks, searching for undefined behavior(UB). Anywhere UB was identified, it was replaced with safe Rust implementation. There are no reports of UB in the remaining unsafe blocks. Further, an RFC addressing uninitialized memory buffers will help address several more unsafe blocks in the actix projects once a solution is released.
Actix-web is one of the most widely used Rust web frameworks. Extensive usage has helped pinpoint issues only found within production environments, such as low-level memory leaks. Version 3 includes several bug fixes addressing memory leaks.
Thanks
Special thanks to @Shnatsel and @Nemo157 for helping with unsafe concerns. We appreciate your perseverance!
Getting Started
If you have never used Actix-Web before, or are not familiar with the new macros, here is a simple example to get started:
You can find a full getting started guide on the actix.rs website.
Alternatively, you can have a look at the multitude of examples covering all subjects including: Sessions, State Management, Databases, WebSockets, Multipart File Uploads, JSON API, Authentication, Middleware, Templates, GraphQL and more!
Stability Updates
Thanks
Getting Started
use actix_web::*;
#[get("/{name}")]
async fn index(name: web::Path<String>) -> impl Responder {
format!("Hello {}!\n", name)
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(index))
.bind("[::]:8080")?
.run()
.await
}