Rust 1.46 Adds New APIs
Written by Kay Ewbank   
Thursday, 03 September 2020

Rust has been updated with a new version that has two new APIs alongside improvements to const fn. The new release coincides with details from the Rust core team on how it sees Rust developing in the future.

Rust was designed to offer a safe, fast and concurrent language without having a garbage collector. To achieve this, it is constructed so that problems are detected at compile time meaning it can be safely used for systems programming. Rust was originally sponsored by Mozilla, and is intended for use in situations including embedding in other languages, writing programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems.

rust

The improvements to const fn extend the core language features you can use in a const fn. The list includes if, if let, and match, as well as while, while let, and loop. You can also now use the && and || operators in a const fn, and you can also cast to a slice. The developers say that while the use of all these was possible outside of const fn, they add a lot of compile-time computation power. As an example, the const-sha1 crate can let you compute SHA-1 hashes at compile time. This led to a 40x performance improvement in Microsoft's WinRT bindings for Rust.

Another improvement is linked to the better error messages introduced in the March release of Rust. These caused unwrap and related functions to panic, and the implementation wasn't stable. Rust 1.46 stabilizes this feature. If you're writing a function like unwrap that may panic, you can now add an attribute called #[track_caller] that will be used by the default panic formatter as the location in its error message.

Two new APIs were stabilized this release - :Option::zip has been expanded to be able to zip multiple items, and vec::Drain::as_slice which returns the remaining items of this iterator as a slice.

The new release was made soon after the announcement by the Rust Core Team and Mozilla of plans to create a Rust Foundation. The Rust Core Team's goal is to have the first iteration of the foundation up and running by the end of the year.  Prior to this, Mozilla had announced plans to restructure the company and to lay off around 250 people, including active members of the Rust project and the Rust community. 

rust

More Information

Rust Website

Related Articles

Rust 2018 Released To Improve Developer Productivity

Rust Survey Revelations

Rust Is Safer But Do We Use It Safely

Rust 1.39 Gets Async-Await

Rust 1.28 Improves Memory Use

Rust 1.26 Adds Existential Types

Rust 1.24 Adds Reformatter

Rust 1.23 Uses Less Memory

Rust 1.20 Adds Associated Contents

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook or Linkedin.

Banner


Cockroach Creates Pebble
28/09/2020

Cockroach Labs has introduced Pebble, which is described as a RocksDB inspired and RocksDB compatible key-value store. Until now, CockroachDB has used RocksDB as its key-value store, but Pebble provid [ ... ]



JetBrains Kotlin 1.4 Online Starts Today
12/10/2020

Kotlin 1.4 Online, a 4-day event organized by JetBrains, the creators of Kotlin, starts today, October 12th and continues until Thursday. Each day's program includes four 30-40 minute talks and is rou [ ... ]


More News

square

 



 

Comments




or email your comment to: comments@i-programmer.info