Rust 1.94 Now Available with New Slice Iteration API

Rust 1.94 introduces the array_windows slice iterator, support for Cargo config includes, TOML 1.1 parsing, and several stabilized APIs.

The Rust Release Team has officially released version 1.94 of the Rust programming language. Developers can upgrade immediately using the official toolchain by running rustup update stable. Here are the changes.

A key addition is the array_windows method for slices. This iterator functions like the existing windows method but returns fixed-size arrays rather than dynamically sized slices, allowing the compiler to infer the window size from usage.

With that said, developers can now iterate over a slice in constant-size windows and destructure elements directly in a closure, with the compiler automatically inferring the window size.

Moreover, Cargo now supports an include key in configuration files such as .cargo/config.toml, enabling configuration fragments to be split across multiple files. The new include mechanism supports both simple file paths and inline tables, providing additional control, such as optional configuration files that may not exist in every environment.

Cargo now also supports parsing TOML 1.1 manifests and configuration files. Regarding syntax improvements, Rust 1.94 introduces multiline inline tables with trailing commas, additional string escape sequences, and optional seconds in time values.

Using TOML 1.1 features increases the minimum supported Rust version required to parse the manifest. However, Cargo automatically rewrites manifests during publication to maintain compatibility with older parsers, ensuring crates continue to support earlier toolchains even when newer syntax is used in development.

Several mathematical constants, including EULER_GAMMA and GOLDEN_RATIO for both f32 and f64, are now available in the standard library. Finally, Rust 1.94 also stabilizes a range of APIs across the standard library. For a detailed list of changes, refer to the official announcement.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Leave a Reply

Your email address will not be published. Required fields are marked *