Why Did Fish Shell Make the Big Move to Rust?
Today’s Issue: Our Anniversary, Advent of Code to the Nintendo DS and Rust University Course Exercises
Season's Greetings, Rustaceans!
With Christmas just a few days away, we extend our warmest wishes for a joyous holiday season.
In this issue, we'll discuss the major reasons behind Fish shell rewrite in Rust, challenge you to implement a solution for unique characters in a string, spotlight an amazing Rust project, and share some incredible links of the week.
Here’s issue 49 for you!
🎉 A Message for You
On December 18th, we celebrated our first anniversary here at Rust Bytes! Over the past year, we’ve sent out 49 emails, and it’s all thanks to you! We sincerely appreciate your continued support—thank you for opening our emails and being a part of this journey. Your time and engagement mean the world to us.
To celebrate this milestone, we’ll be compiling all the challenges and tips we've shared into an easy-to-navigate PDF and EPUB formats. Expect to see this compilation early in the new year.
If you enjoy Rust Bytes, please do share the newsletter with your friends. Your support helps us grow, and we’re excited for everything to come.
THE MAIN THING
Why Did Fish Shell Make the Big Move to Rust?
Let's face it, the world of tech moves faster than a rogue shopping cart on a downhill slope. Fish Shell, once written in C++, faced growing limitations that became harder to ignore. The maintainers knew it, and they decided to take a bold step: rewriting the whole thing in Rust!
Now, this wasn't some impulsive decision fueled by a late-night pizza binge. It was a well-considered move, like finally cleaning out that garage.
Here's the lowdown on why Fish Shell, which has been swimming along just fine in C++, suddenly decided to move into the world of Rust?
A Brief History of Fish Shell's Journey: From C to C++ to Rust
Fish Shell was created in 2005 and was written in C. The original design used
wchar_t
for Unicode, which was common at the time but ultimately turned out to be problematic with modern needs.The Move to C++ (2009)
After a few years, Fish’s development slowed down until it was revived in 2009. At this point, the project was ported from C to C++ to take advantage of better data structures and more modern programming features.
Why C++ Wasn't Enough (Recent Years)
Despite the improvements, C++ started showing its age and the frustrations that come with it—complicated threading, poor string handling, and constant headaches with outdated libraries.
Fish needed the ability to run multiple processes simultaneously without messy subshells, but C++’s threading model was unreliable and prone to errors, making concurrency difficult to manage safely.
Why Rust? The Perfect Fit for Fish Shell
Safe Concurrency: Rust’s ownership model and built-in thread safety were exactly what Fish needed to solve the threading issues without the complexity and risks associated with C++. Rust makes it easier to manage background tasks and run multiple processes in parallel safely.
Performance & Safety: Rust combines C-like performance with modern memory safety features, preventing the types of bugs that were common in C++ (like use-after-free and data races).
Learning Curve & Familiarity: The team already had experience with Rust, so adopting it wasn’t as steep a learning curve as it might have been for other languages. Plus, Rust was gaining popularity in the developer community, which meant that the team would have support and resources to help them succeed.
Existing Code: The fact that the team already had a starting point for the rewrite made the decision easier. Instead of starting from scratch, they had a working PR and a clear path forward, making it a calculated move rather than a drastic, sudden change.
With Fish Shell v4.0b1 now fully rewritten in Rust, what does this mean for you, the Fish user? Is it a game-changer, or just another example of the 'rewritten in Rust' trend? Comment on what you think.
RUST CHALLENGE
In the previous issue, we challenged you to implement pathfinding in a grid. A special thanks to everyone who completed the challenge. You can find the solution in the Rust Playground.
Let's move on to our next challenge.
Unique Characters in a String
Problem Description
Write a function has_unique_chars that takes a string as input and returns true
if all ASCII characters in the string are unique, and false
if any character is repeated. Only ASCII characters should be considered.
All non-ASCII characters (such as emojis, special characters, spaces, etc.) should be ignored in the check.
pub fn has_unique_chars(input: &str) -> bool;
You can start writing and testing your solution on Rust Playground. Once completed, please share your code with us on Twitter, or as a reply to this email.
PROJECT SPOTLIGHT 💡
Avian Physics Engine
Avian is an ECS-driven 2D and 3D physics engine built specifically for the Bevy game engine. Its main goal is to provide seamless physics integration within Bevy, making it easy for developers to implement realistic movement, collision detection, and physical interactions in their games or simulations.
Avian is designed to be modular, highly customizable, and easy to use, offering a familiar and ergonomic API.
Key Features:
Rigid Bodies: Avian supports dynamic, kinematic, and static rigid bodies, including features like linear and angular velocity, external forces, gravity, and damping.
Collision Detection: Powered by Parry, Avian provides robust collision detection, including Continuous Collision Detection (CCD), configurable collision layers, and collider generation for meshes and entire scenes.
Joints and Constraints: The engine includes several built-in joint types such as fixed, distance, and prismatic joints. It also supports custom joints using XPBD (extended position-based dynamics).
Spatial Queries: Features like raycasting, shapecasting, point projection, and intersection tests are available, with an ergonomic component-based API for spatial queries.
Debugging and Visualization: Avian offers powerful debug rendering tools to visualize colliders, AABBs, contacts, and joints, helping developers troubleshoot their physics systems.
What’s next
Future versions of Avian may include soft bodies, fluid simulations, performance optimizations, and additional cross-platform features, such as joint motors and articulations.
AWESOME LINKS OF THE WEEK 🔗
Jakub Beránek released Rust university course exercises! If you've conquered Rustlings and are itching for your next adventure, this is your perfect next quest.
Nick Fitzgerald wrote about Making WebAssembly and Wasmtime More Portable.
Henk Oordt wrote about Trash in, treasure out, on how Rust's type system lets you encode constraints and semantics in your API.
Dens Sumesh just released Broccoli—a robust message queue system for Rust applications, build as the Rust alternative to Celery. Time to give your async tasks an upgrade!
Lura Skye tackled the Advent of Code mysteries; how about bringing Advent of Code to the Nintendo DS?
Nick Fitzgerald wrote on the ByteAlliance blog about making WebAssembly and Wasmtime more portable.
Yoshua Wuyts wrote an interesting article about temporal and spatial memory safety.
Jack Nichols wrote on the Wap blog about reducing WASM binary size: lessons learned from building a web terminal.
Chris Krycho released an article on using Drop or safety in Rust. A deep dive into Rust’s vec::Drain and its Drop implementation.
A recent article discusses the four limitations of Rust's borrow checker.
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!
That's all for now, Rustaceans. Stay hydrated and keep up with those exercises!
John & Elley.