Mara Bos
Mara Bos

@m_ou_se

9 Tweets Feb 06, 2023
๐Ÿ†•๐Ÿฆ€ Just moments ago, @rustlang 1.62.0 was released! ๐ŸŽ‰
As usual, a thread with some of the highlights. ๐Ÿงต
1/9
blog.rust-lang.org
Cargo now has 'cargo add' built-in: a (sub)command to add a crate to your Cargo.toml. It automatically looks up the latest version, and shows you the available features of the crate.
See `cargo add --help` for more details.
2/9
On Linux and several BSDs, std::sync's Mutex, RwLock, and Condvar now no longer do any allocations. They used to be (heap-allocated) wrappers around pthread lock types, but have been replaced by a minimal, more efficient, futex-based implementations.
3/9
#[derive(Default)] is now available for enums. You can select which variant should be used for the default value with a #[default] attribute.
For now, this only works on unit variants (containing no data). This might be extended in a later version.
4/9
The `bool` primitive type now has a new method: `.then_some()`. Calling `true.then_some(x)` results in `Some(x)`, while `false.then_some(x)` gives you `None`. It allows you to easily check if a condition is true, and then produce a Some if that was the case.
5/9
The floating point types, f32 and f64, now have a method called `total_cmp` to compare them using a total ordering that includes NaN, instead of the usual partial ordering in which NaN is unordered.
This is especially useful when sorting floats.
See doc.rust-lang.org
6/9
You can now call `.lines()` directly on `std::io::stdin()`, to easily process standard input line by line.
7/9
The x86_64-unknown-none target can now be installed through rustup, making it easier to compile (no_std) software for "bare metal" x86_64.
8/9
And that's all I wanted to highlight for now!
For a more complete list of changes in Rust 1.62, check the release notes:
Rust: #version-1620-2022-06-30" target="_blank" rel="noopener" onclick="event.stopPropagation()">github.com
Cargo: #cargo-162-2022-06-30" target="_blank" rel="noopener" onclick="event.stopPropagation()">github.com
Clippy: #rust-162" target="_blank" rel="noopener" onclick="event.stopPropagation()">github.com
Enjoy! โœจ๐Ÿฆ€
9/9

Loading suggestions...