What to expect

Rust 1.7 stabilizes library functions and methods

Gabriela Motroc
Rusted iron plate image via Shutterstock

The Rust team has introduced the latest version of the systems programming language -1.7, which continues the course of 1.6. What this release focuses on is library features -roughly 40 library functions and methods are currently stable in 1.7.

Two months after releasing Rust 1.6, the team is announcing the 1.7 version. According to the official blog post, this version is mainly about library features. “While we have several language features cooking for future releases, the timeframe in which 1.7 was developed included the holidays, which means less time for commenting on GitHub and more time for spending with loved ones,” the Rust team wrote.

Most significant changes in Rust 1.7

Unlike Rust 1.6, which focused on small refinements, one major feature and a change to, 1.7 focuses on the roughly 40 library functions and methods that are now stable. The Rust team announced that one of the biggest APIs stabilized was support for custom hash algorithms in the standard library’s HashMap<K, V> type. Until now, all hash maps used SipHash as the hashing algorithm, which offers protection against DOS attacks by default. However, SipHash is not very fast at hashing small keys while the FNV hash algorithm is much faster for these size of inputs. As a result, a significant speedup occurs by switching hash algorithms for types such as HashMap<usize, V>, provided that the loss of DOS protection is acceptable.

SEE ALSO: Rust vs Java: A tale of two competitive programming languages

Generally, the hasher does not have to be specified because type inference takes care of it. Therefore, HashMap: :default () should be enough to get up to two times faster hashes. Hash trait is agnostic to the hashing algorithm used, which means that no changes are needed to the types being inserted into hash maps to reap the benefits.

Further improvements

Other significant improvements include <[T]>: :clone_from_slice (), an effective method to copy the data from one slice and place it into another slice and a variety of convenience methods on Ipv4Addr and Ipv6Addr, such as is_loopback (), which returns true or false if the address is a loopback address according to RFC 6890. There are also various improvements to CString, used for FFI. Although there have been checked, saturated, and overflowing operations for different numeric types, they are not included in the ’40’ number because regardless of the huge number, they all do the same thing.

As far as Cargo is concerned, there are two small updates. First,  an improvement has been made to build scripts which enables them to precisely inform Cargo about dependences to make sure they are only rerun when those files change. Second, Rust 1.7 contains a modification to the cargo rustc subcommand, which allows specifying profiles to pull in dev-dependencies during testing and such.

For more information, check the detailed release notes.

Gabriela Motroc
Gabriela Motroc was editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Inline Feedbacks
View all comments