-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
v3 Announcement
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 asactix_web::rt
, too. - Improvements to data containers: default services can now access app data,
Resource
s andScope
s can access parent data while holding their own data, andServiceRequest::app_data
returnsT
instead ofData<T>
which fully enables passing custom types between middleware, extractors and handlers.
Check out what else is new and what's changed in the changelog and the migration/breaking change notes. Actix-Web’s minimum supported Rust version (MSRV) is now 1.42 (released in March 2020).
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.
Special thanks to @Shnatsel and @Nemo157 for helping with unsafe concerns. We appreciate your perseverance!
If you have never used Actix-Web before, or are not familiar with the new macros, here is a simple example to get 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
}
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!
Ask Questions in the Discord Server