Rust Bytes: Predictions and Speculations on the Future Direction of the Rust Language and Ecosystem
Hello Rustacean! Welcome to another edition of the Rust Bytes newsletter. In this issue, we'll shine a spotlight on an amazing Rust project, present our spot-the-bug challenge, and share some incredible links of the week.
Welcome to Issue 19!
The Main Thing
Predictions and Speculations on the Future Direction of Rust
Despite widespread support and praise since its launch, including high-profile attention from the White House, Rust hasn't been without its challenges. While its adoption is still growing, many companies are eager to join the movement and use Rust for their products.
However, a vibrant and dedicated community has emerged around Rust, actively promoting the language and its benefits.
Here is what we predict could be the future of this language.
Ecosystem Expansion: We speculate Rust’s adoption to sky rocket in the coming years this includes a wide enterprise adoption, flourishing stable tooling/frameworks, and interoperability bridging with seamless integration with existing systems is paramount for broader adoption. Advancements in tools and libraries that facilitate smooth collaboration between Rust code and non-Rust components are likely on the horizon.
Language Evolution: As Rust evolves, we expect gradual additions of features that alleviate common challenges without compromising Rust's core principles. Alternatively, there will be improved effort to improve developer experience, with a focus on tools and features streamlining productivity. Furthermore, given the prevalence of multi-core processors, Rust will likely prioritise improvements in concurrency support, potentially advancing async/await, channels, and actor models to simplify concurrent programming tasks.
New Frontiers for Rust: Rust's efficiency and safety makes it a perfect fit for resource-constrained devices in the Internet of Things (IoT) space. While Rust is already a prominent language for WASM compilation. Expect Rust to play an even greater role in developing high-performance web applications and serverless computing functions that leverage WASM. Similarly, Rust's unique blend of performance and memory safety could attract more developers in scientific computing and High-Performance Computing (HPC) domains.
Challenges and Considerations: Rust's relatively steep learning curve might continue to be a barrier for some developers. Addressing this with improved quality learning resources and developer tooling will be crucial for wider adoption. While Rust has made significant strides in compiler speed, further improvements are necessary. Initiatives to promote diversity and inclusion will be critical for long-term sustainability.
With a focus on safety, performance, and developer experience, Rust is well-positioned to address the evolving needs of software development in various areas. Continued ecosystem growth, language evolution, and exploration of new use cases will solidify Rust's place as a leading language for shaping the software landscape of the future. The future looks rusty!
Spot the Bug
Identify why the code fails to compile and suggest a way to fix it.
Share your solution in the comments below for a chance to be featured in our next newsletter!
Project Spotlight
lychee
lychee is a powerful, fast, asynchronous link checker written in Rust that helps you find broken links and mail addresses within various file formats, including markdown, HTML, reStructuredText, and websites.
Key Features:
Fast and Efficient: lychee utilizes asynchronous processing and streams for optimal performance.
Versatile Input Handling: It can check links from local files, remote URLs, and even standard input.
Detailed Output: lychee provides comprehensive reports on broken links and their status codes.
Customization Options: You can fine-tune lychee's behavior with parameters like user-agent, retry logic, and excluded URLs.
Multiple Usage Modes: Use it as a command-line tool, a library for your projects, or a pre-commit hook.
Lychee is open-source on Github
Awesome links of the week
The deadline (April 25th) for submitting talk proposals for RustConf 2024 is fast approaching. Don't miss out on this opportunity to share your knowledge and inspire learning. Submission Link ⏰.
Marlon and Max co-authored an article titled "Save the planet, code in Rust" on the Tweede golf’s blog. They discuss how using Rust can be more environmentally friendly than languages like PHP.
Miguel Young authored a comprehensive and thoughtful guide proposing a new calling convention for Rust. He argues that the current convention, based on the C ABI, is not optimal for Rust's requirements. Link.
SeaORM is nearing a stable release with its v1.0.0 release candidate (rc) now available. Stay tuned for exciting new features and enhancements coming soon. Link.
Andreas Fuchs wrote about some useful types for database using Rust web apps.
Matilda Smeds authored an insightful guide on logging in asynchronous Rust applications. She explores the concept of logging and delves into practical implementation using the tracing and tracing-subscriber crates. Link.
Casey Primozic wrote a review after trying out Cloudflare's Rust service foundations library. Link.
Saoirse a.k.a Without Boats wrote a guide exploring the concepts of coroutines and effect handlers in programming languages, and argues that coroutines offer a more advantageous approach. Link.
Benno van den Berg and Luca Palmieri gave a techtalk discussing Fiberplane's 3-year experience using Rust to build an observability product and interactive notebook. Link.
Goodness Duru shares his insights in an article guide about what he learned from building a PostgreSQL extension in Rust. Link.
Spot The Bug: Solution
The Bug: Compiler error!
The bug in the code is that it attempts to mutate the numbers vector while iterating over it immutably. In Rust, when you iterate over a collection using a borrowed reference (such as &numbers), you cannot mutate the collection. Therefore, attempting to push elements into the numbers vector inside the loop causes a compilation error because it violates Rust's borrowing rules.
Solution:
```
fn main() {
let mut numbers = vec![1, 2, 3, 4, 5];
let len = numbers.len();
for _ in 0..len {
numbers.push(numbers[numbers.len() - len] * 2);
}
println!("Doubled numbers: {:?}", numbers);
}
```
In this corrected version, we first store the length of the numbers vector in a variable len. Then, we iterate over the range 0..len, which ensures that the loop runs for the original length of the vector. Inside the loop, we push the doubled value of each element from the original numbers vector.
Before You Go
To support the newsletter:
❤️ Recommend the newsletter to your friends: it really helps!
💸 Sponsor the newsletter.
🤳 Check us out on our socials: X, Rustaceans Publication.
📨 Contact us through rustaceanseditors@gmail.com feedback is welcome.
That's all for now, Rustaceans! Until next week, have a productive week ahead.