MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
rust
Recherche

Rust 1.85 arrives with long-awaited async closures

vendredi 28 février 2025, 22:43 , par InfoWorld
Rust 1.85, the latest version of the burgeoning language positioned for speed, safety, and ease of use, has arrived, with new capabilities including async closures. The release also constitutes a stabilization of the Rust 2024 edition of the language.

The Rust 1.85 version was introduced February 20 and can be downloaded on GitHub. Developers with a previous version of Rust installed via rustup can access Rust 1.85 using the command: rustup update stable.

The async closures feature returns futures when called. A goal of the Rust 2024 project, this feature works like an async fn  that also can capture values from the local environment, the Rust release team said. The long-awaited feature is said to increase the expressiveness of the Rust language, filling a gap in the async ecosystem. The async closures feature addresses previous shortcomings of Rust when writing asynchronous code that uses closures and Fn trait bounds. These include an inability to express higher-ranked async function signatures, and a situation in which closures could not return futures that borrowed from the closure captures.

Also in Rust 1.85, a new #[diagnostic::do_not_recommend] attribute is a hint to the compiler not to show the annotated trait implementation as part of a diagnostic message. For library authors, this makes it possible to keep the compiler from making suggestions that may be misleading or unhelpful. The compiler in Rust 1.85 also removes the unstable flag, -Zpolymorphize. And panics in the standard library now have a leading /library in their path.

Stabilized APIs such as BuildHasherDefault::new, ptr::fn_addr_eq, and Unsigned {integer}::midpoint feature in Rust 1.85, along with a new tuple extension. Previous versions of Rust implemented convenience traits for iterators of (T, U) tuple pairs to behave like Iterator::unzip, with Extend in Rust 1.56 and FromIterator in Rust 1.79. These have been extended to more tuple lengths, from singleton (T,) through to 12 items long, (T1, T2,.., T11, T12).

With Rust 2024, Rust proponents are offering the largest edition of the language ever released. These editions are a mechanism for opt-in changes that might otherwise present a backward compatibility risk, the team said. A guide has been set up for transitioning projects to the 2024 edition.
https://www.infoworld.com/article/3835168/rust-1-85-arrives-with-long-awaited-async-closures.html

Voir aussi

News copyright owned by their original publishers | Copyright © 2004 - 2025 Zicos / 440Network
Date Actuelle
lun. 3 mars - 21:27 CET