Rust programming language’s newest update introduces array windows for slices and versatile include paths for Cargo configurations.
<div class="media-with-label__label">
Image Source: AL-art/Shutterstock
</div>
</figure>
</div>
</div>
</div>
</div>
<div id="remove_no_follow">
<div class="grid grid--cols-10@md grid--cols-8@lg article-column">
<div class="col-12 col-10@md col-6@lg col-start-3@lg">
<div class="article-column__content">
The Rust development team has officially released Rust 1.94. This significant update introduces an innovative array windows feature for iterating through Rust slice types, alongside enhanced capabilities for managing Cargo project configurations.
Rust 1.94 was publicly released on March 5th. Existing Rust users can seamlessly upgrade to this stable version by executing the command rustup update stable through rustup.
The newly introduced array_windows method functions similarly to the existing windows method, but it operates with a fixed length. This means its iterator yields items as `&[T; N]`—arrays with a known size—rather than the dynamically sized `&[T]` slices. Often, the required window length can be automatically deduced from how the iterator is utilized. Slices provide a mechanism for developers to create references to contiguous sequences of elements within a collection.
Cargo, Rust’s robust package manager, now offers support for the include key within its configuration files (.cargo/config.toml). This enhancement allows for more structured organization, easier sharing, and streamlined management of Cargo configurations across diverse development environments and projects. Furthermore, these include paths can be designated as optional, accommodating scenarios where they might not always be present.
Cargo has upgraded its parsing capabilities to support TOML v1.1 for both manifests and configuration files. TOML, an acronym for Tom’s Obvious, Minimal Language, is intentionally designed as a straightforward configuration file format, prioritizing readability through clear semantics. Key additions in TOML 1.1 include the ability to use inline tables spanning multiple lines and incorporating trailing commas, new string escape characters like `\xHH` and `\e`, and optional seconds within time definitions. Adopting these new features in your Cargo.toml file will necessitate an increased development MSRV (minimum supported Rust version) to ensure compatibility with the updated Cargo parser. Third-party tools that process manifest files may also require updates to their parsers. However, Cargo intelligently rewrites manifests during the publication process to maintain backward compatibility with older parsers, thereby still allowing support for earlier MSRVs.
Beyond these changes, Rust 1.94 also stabilizes an additional 17 APIs. This latest Rust release comes on the heels of Rust 1.93, launched on January 22, which brought improvements to DNS resolver operations within the musl implementation of the C standard library.