Rust 2024 Edition Reaches Stability
Today’s Issue: What’s in a Ring Buffer?, Solving The Millionaires' Problem in Rust, and Introducing a Rust Web Framework for Lazy Developers.
Hello Rustaceans! 🦀
Welcome to another edition of Rust Bytes, where we will discuss the new release of Rust v1.85.0 and the much-anticipated Rust 2024 edition, challenge you to implement a solution for the longest increasing subsequence problem, spotlight an amazing Rust project, and share some incredible links of the week.
Here’s issue 55 for you!
THE MAIN THING
Rust 2024 Edition Reaches Stability
Last week was full of excitement. Microsoft unveiled Majorana, the world’s first quantum processor powered by topological qubits. Apple also rolled out updates for its latest gadgets, and Rust released version 1.85.0, officially stabilized alongside the shiny new Rust 2024 edition. Talk about a week of tech greatness!
If you are wondering what Rust editions are and what they achieve, here is a little introduction. Rust editions are a collection of opt-in changes that might otherwise break backward compatibility. What does this mean? Whenever a new feature is added to Rust, it’s the responsibility of maintainers to ensure that feature is supported in future releases.
However, some new features may introduce breaking changes in older releases. In such cases, the feature is moved to a new edition. This approach allows Rust to handle backward incompatibility gracefully. Check out Rust editions if you’re interested in learning more about them.
This latest release of v1.85.0 which stabilized Rust 2024 edition came with new exciting language features. Here’s a summary of the highlights:
Rust 2024 Edition. Key changes include improvements to RPIT lifetime capture,
if let
and tail expression temporary scopes, unsafe extern blocks and attributes, and more. It also reserves several keywords for future features.Async Closures. Rust now supports
async || {}
closures, which return futures and can capture values from the local environment. This is a powerful new feature that simplifies asynchronous programming and allows for more expressive higher-ranked function signatures with the newAsyncFn
traits.Hiding Trait Implementations. The
#[diagnostic::do_not_recommend]
attribute allows crate authors to control which trait implementations are suggested by the compiler in diagnostic messages, preventing potentially misleading advice.FromIterator
andExtend
for Tuples. These traits, which facilitate collecting into multiple collections at once, are now implemented for tuples of up to 12 elements.Updates to
std::env::home_dir()
. The behavior of this long-deprecated function has been corrected (as a bug fix), and its deprecation will be removed in a future release.Stabilized APIs. A number of APIs have been stabilized, including methods on floats and integers,
std::task::Waker::noop
, and several others. Many APIs are now also stable inconst
contexts.Rustfmt Style Editions. Rustfmt introduces "style editions", allowing formatting to evolve independently of the Rust language edition. Numerous formatting fixes and improvements are also included.
Cargo Improvements. Cargo now considers the
rust-version
field in dependency resolution and has improved consistency in table and key names.
These changes are huge, and the async closures? Well, they’ve been on everyone’s wish list. We’re crossing our fingers that they’ll make life a whole lot easier! Oh, and true to tradition, Niko Matsakis has dropped a song for this edition (yep, Rust 2024 Is Coming—catchy, right?).
What features have you been eagerly waiting for in this release? Drop your thoughts in the comments below! But hey, before you do, check out this week’s challenge!
RUST CHALLENGE
In the previous issue, we challenged you to implement a solution for the smallest window problem. Good work from Mohammad, and everyone who took on the challenge.
Let's move on to this weeks challenge.
Longest Increasing Subsequence
You are given an array of integers nums
, find the length of the longest increasing subsequence. A subsequence is a sequence derived from the array by deleting some or no elements without changing the order of the remaining elements.
Example:
assert_eq!(longest_increasing_subsequence(vec![10, 9, 2, 5, 3, 7, 101, 18]), 4);
assert_eq!(longest_increasing_subsequence(vec![0, 1, 0, 3, 2, 3]), 4);
assert_eq!(longest_increasing_subsequence(vec![7, 7, 7, 7, 7, 7]), 1);
Test your solution on Rust Playground. Once completed, please share your code on Twitter, or as a reply to this email.
PROJECT SPOTLIGHT 💡
Serde: Supercharging Serialization and Deserialization
Serde is a powerful serialization and deserialization crate designed to efficiently convert Rust data structures into different formats and vice versa.
With Serde, you can easily work with various data formats such as JSON, YAML, and more, making it essential for building applications that interact with external systems, APIs, or databases.
What Problem Does Serde Solve?
In most modern apps, data must be serialized or deserialized for tasks such as saving to disk, sending over networks, or working with APIs. However, this process can be error-prone, especially when handling complex data structures, dynamic data or switching between multiple formats.
Serde solves this problem by providing an efficient, flexible, and type-safe solution to serialization and deserialization of such data.
It eliminates the need to manually write conversion logic for each format and data structure, making it easy for you to focus on the core of your applications without worrying about the intricacies of serialization.
Usage:
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct User {
name: String,
age: u32,
}
Here is what makes Serde awesome:
Efficiency - Serde is optimized to ensure minimal overhead and fast serialization/deserialization operations.
Flexibility - It supports a wide range of formats (JSON, YAML, etc.) and you can also easily customize and extend Serde to handle your specific needs.
Ease of Use - Serde relies on Rust's powerful type system and derives macros (
#[derive(Serialize, Deserialize)]
) to simplify the process of converting data structures.
Serde is one of those crates that's not only well-maintained but also has a strong track record of stability, so we can expect it to continue thriving—unless something unexpected arises. On top of that, there’s an active community around it.
If you need to serialize and deserialize data efficiently, Serde is a must-have. The best part? You can integrate it seamlessly into anything, from web services to command-line tools to embedded systems.
Still not convinced? Check out the project yourself here.
AWESOME LINKS OF THE WEEK 🔗
Luca Palmieri has released eserde, a crate built on top of Serde, designed to offer improved error reporting capabilities when deserializing user-facing payloads.
Mateusz Maćkowski has released the Cot crate, a web framework that offers a Django-like experience and designed for developers who want to get things done quickly. It’s not production-ready yet, but you can still poke your nose in it.
Nicole Tietz-Sokolskaya wrote an insightful article on What's in a ring buffer? and how to use them in Rust.
Matthew Plant wrote about why he’s writing a Scheme implementation in 2025 — spoiler alert: it’s all about async Rust!
Ross Sullivan wrote about Scaling PayPay with Rust.
Submissions and talks for the Scientific Computing in Rust Virtual Workshop 2025 are now open! The workshop will take place from July 4th to 6th, and hey, registration is free!
Rain’s article on Demystifying Monads in Rust through Property-Based Testing is a must-read—so good, it might just convert you to the monad side!
Matt Mastracci and Michael J. Sullivan wrote a post on the EdgeDB blog about C stdlib isn’t threadsafe and even safe Rust didn’t save us. They highlight the challenges of working with Rust in a mixed environment, and insights into memory safety and concurrency.
Yoray Herzberg wrote an interesting blog on Solving The Millionaires' Problem in Rust.
Azure has released the first beta of the AzureSDK crate. This initial release includes support for Key Vault Secrets and Keys, Event Hubs with AMQP support, with Cosmos coming soon.
SUPPORT RUST BYTES👋
You're Rust Bytes biggest fans, and we love to see it. Here’s how you can help spread the word:
❤️ Recommend Rust Bytes to your friends.
🤳 Connect with us on our socials: X, Rustaceans Publication.
📨 Email us at rustaceanseditors@gmail.com with feedback or ideas.
☕️ Buy us a coffee to support our editors!
We welcomed the birth of my daughter on the 18th! I’m officially a dad and excited for what’s to come.
That's all for now, Rustaceans.
John & Elley.