I spent 18 months rebuilding my algorithmic trading platform in Rust. I’m filled with regret.

Austin Starks
6 min readJun 28, 2024

--

I was a young, hopeful Rust fanatic. On paper, Rust seemed like the programming languages designed by the gods. Not only is it the fastest programming language out there, its also one of the safest.

I’m not alone in thinking Rust was this perfect language. If you read about the Rust programming language online, you’ll likely encounter overwhelmingly positive opinions. Every guide on Medium, every post on Reddit, every answer on Stack Overflow — everything is glowing.

GitHub post about Rust being the most admired language among developers

Given this, I decided to migrate away from TypeScript re-write my entire open-source algorithmic trading system in Rust.

I gave Rust a neutral rating before. I take that back

I wrote about my experience with Rust 4 months ago. In my last article, I concluded that while I really like the speed and some aspects of the language design (such as enums and strong typing), I didn’t really love the language. My article was met with harsh criticism on Reddit, including one highly upvoted comment that accused me of using ChatGPT to write my article.

Me having to defend myself against angry Rust fanatics on Reddit

After posting, I had thought that I didn’t give Rust a fair shot. Maybe I was just naive, or came in with misplaced expectations.

Now, after working with the language for a little while longer, I can confidently make one conclusion…

This language absolutely fucking sucks.

What I DESPISE About Rust

If you want to find an article about what’s right with Rust, look literally anywhere on the internet. You’ll be hard-pressed to find anything less than neutral about the language. This article will be a focused rant about what I despise about this crabby language.

The Rust Mascot is a Crab. Get it? Because its crappy

Horrendous, verbose, unintuitive syntax and semantics

An example of a complex Rust function

Anybody who ever said that Rust doesn’t have atrocious semantics is lying to your face. There are certain things where, if you don’t have access to an extremely powerful Large Language Model, then writing the function becomes literally impossible. I don’t want to spend 90 minutes figuring out the where clause in my run_transaction function. I just want to write my damn function.

In the end, I had to abandon the idea of a helper function entirely, because I quite literally couldn’t get the code to compile. What people claim as Rust’s biggest strength (a strict compiler to eliminate errors) is one of Rust’s biggest flaws. Just give me a garbage collector, and let me do what I want to do!

In contrast, if I were writing this exact same function in Go, it would look something like this:

The Go implementation of the function

While the core of the function remains relatively the same, you don’t have to do backflips to figure out how to make the dang code work. It just works!

Horrendous Error Handling

Rust does do some very nice things with errors. As long as you avoid unsafe unwraps , you can be damn sure that the code will run and keep running. NilPointerExceptions and unhandled errors just don’t happen anymore. Yay! (right?)

Wrong. Because when your data is wrong or something unexpectedly happens, you will be FIGHTING to figure out what the hell happened. Maybe I’m just an idiot and can’t figure out how to enable stack traces. But when an error happens in my application, I have no idea why!

Where the hell is my stack trace???

In contrast, with a language like Python, you get these beautiful, art-like stack traces that tell you exactly what happened, down to the line number! Even in Go, you have errors.Wrap(...) , which enable you to look at the entire error stack in your application. Perhaps I’m a goddamn idiot, because when I encounter an error in Rust, I’m in Lala land tryna figure out what the hell happened. I need an eprintln!(...) littered throughout my application.

In fact, no, I’m not an idiot. This is a flawed language design.

Crabby Community

Hot take: the Rust community isn’t as nice and cool as they pretend to be. They’re a bunch of narcissistic assholes that hate being told that their favorite language has flaws.

An example of a rustaceon providing “”helpful”” advice to my question

For example, I asked a question on the Rust subreddit about how to improve error handling with the MongoDB Rust crate. My answers ranged from:

  • Switch to Postgres (yeah, like I’m going to re-design my entire database because of some crappy error messages)
  • Why am I using MongoDB at all? (I like it. Next question?)
  • MongoDB is bad in Go and Python too (Maybe it is, maybe it isn’t. It’s fine in TypeScript, and your whataboutism doesn’t answer my question)
  • (Rare) An actually helpful suggestion to improve the error messages

There is no other programming community that’s as cult-like as Rust. They ignore all of the giant glaring flaws with the language, like its crazy learning curve, verbosity, horrible error messages, crazy syntax and questionable language design choices; they’d rather say it’s a skill issue with the developer. That’s insane to me!

Final Words

With all of this being said, Rust has some pros. It’s fast and…. well, that’s mainly it.

I guess it’s also safe too. If we compare it to C++, it’s obviously the better language. But when compared with other languages (like Go), its “safety” to me is more of a detriment. I’d rather my application take a few dozen milliseconds longer to run if it means my development time is cut in half.

On the bright side, if I chose to write my app in Go, I’d also probably have some regret. “What if it could be faster?” I’d think to myself. “There’s yet another article about how Rust is the best thing since sliced bread. Oh geez. I made a mistake!”

At the very least, now that I know Rust, I feel like I can learn anything. Maybe I’ll pick up OCaml for the hell of it. It can’t be too much worse than Rust, can it?

--

--

Austin Starks

https://nexustrade.io/ Highly technical and ambitious. Building a no-code algotrading platform and an ecosystem of AI applications. https://nexusgenai.io