What got you interested in Rust?

Hi, I've been using Rust for a few years now and wanted to make a youtube channel teaching it. I wanted my first video to talk about the reasons that someone might want to learn Rust. What would draw people to learn Rust if they haven't heard much about it and want to learn more?

I have a few of my own reasons why I like using Rust, but I would love to hear from people with different backgrounds than mine about what drew them to Rust and why they use it.

1 Like

To me Rust is a C replacement. If C didn't die in 1999, that's what I'd expect it to be today.

I can use Rust for everything I used C for, but I don't have to spend time crafting Makefiles, solving memory murder mysteries in debuggers, or cursing at Microsoft for having an awful C compiler with a broken standard library.

17 Likes

One of the reasons was to learn something new.
Another reason is that I am bored with Java/SpringBoot/annotation driven programming :slight_smile:

4 Likes

I remember after seeing a headline somewhere about ripgrep being a lot faster than grep, I was exploring the rust by example website. There was an example of sorting a 100,000 plus word list on multiple threads using rayon. I remember being absolutely blown away that par_iter was all it took. I figured if a language could, in part, make something as performant as ripgrep and if libraries/Stdlib was as crazy easy to use as rayon I had to learn it. Of course the reality of learning it was nowhere near as easy as I thought it would be. But it was so worth it.

4 Likes
  1. Talk "Rust, language for next 20 years" by carols10cents (iirc)
  2. This tweet

Long story short - there are still niches, where efficiency matters and GC/heavy runtime is not a way to go. Until recently, the only lang for such cases was C(++), which have a problem with memory safety. There are some gossips, that its enough to be good developer to write safe C++ code - I don't think I am better than most of M$ devs, and they are not good enough to write memory safe code, so I need help from language. Also some people claims that smart pointers are the perfect cure for this problem, but:

  1. They hits performance
  2. They creates additional problems which need to be handled (easy to create/difficult to find memory leaks). Yes, mem leaks are possible with Rust, but noone would tell you "just use Rc/std::forget everywhere"
  3. Lacking knowledge about how they work brings bugs even harder do find - many devs aren't aware, that smart pointers are not thread safe (unless they are atomic). I saw using std::shared_ptr to share stuff between threads which is obviously not very good idea. Rust doesn't let you do this (it would tell you to use Arc). Also if I am talking about threads - smart pointers doesn't protect from data races at all, and nothing stops you from forgetting mutex lock in C++.

There are also other benefits of learning Rust - really nicely designed standard library (try to implement iterator in C++, and then come back and do this in Rust), very clear and straightforward error handling, nice enums... But they are additional benefits for me.

Obviously this is very much what convinced me as a system developer/C++ developer (and also me being very not happy where C++ is going with latest releases, but this is another topic). If your target are Python or Java or maybe JS devs, you would probably need some other arguments for them (why should they care about platforms where they cannot afford GC, if they would never develop for such platform?).

3 Likes

I am an embedded bare-metal developer and I'm learning Rust mainly because my main line of work uses C. Since some years ago I have been kind of "jealous" of several other lines of work that get new technologies all the time, something that I felt was missing in my field.

Rust to me is a hope to evolve, to eventually completely replace C as my default choice for firmware development. It also fulfills my desire to be "up-to-date". A simply "This Week In Rust" email makes me feel like there are new things happening with Rust, whereas I have never seen anything like "This Week In C". Some people might find this satisfaction when using QT, an RTOS or something like that that you work on top of, but I as a bare-metal guy find it difficult to find exciting new things from the FW development perspective.

2 Likes

Over the decades I have been involved in all kind of system. From deeply embedded real-time systems (avionics, radar, industrial control) to desktop applications (CAD) to server side processing to web browser client. This has involved having to learn and use a dozen different languages, most of which nobody had heard of today.

All that endless language learning, pretty much a different language on every project, has been an annoying and ultimately pointless waste of time.

As a result in recent years I made it a rule to only be concerned with main stream languages that have recognized standards bodies, wide spread support, multiple implementations. That are mature and likely to be around for decades more.

Therefore I studiously avoided fly-by-night, fringe, languages. I came down to three: C, C++, Javascript. With those I could get everything I want done easily and satisfy my requirements as above. The likes of Python, Swift, Kotlin, Java can all take a hike. As can every other new language, we seem to have been hearing of a new language every day for years now.

As such, I should not have looked at Rust at all. In fact I can't remember what it was that I saw that convinced me to try it out. So why am I still here? I found that:

  1. Rust can work well in embedded systems, even small ones.

  2. Rust is available for ARM and RISC V and other architectures.

  3. Rust gives me all the performance of C/C++. For embedded systems and for computer intensive processes in the cloud.

  4. It turns out that with Rust I can do everything I would normally turn to Javascript and node.js for. REST API servers, web socket servers, database interaction etc. Almost as easily as using node but with much better results in terms of performance and stability.

  5. The big one: It does all that with a genuinely new and helpful feature, memory and thread safety. Fantastic, no other language has that.

  6. It gets me away from the ever growing madness of complexity that is C++.

  7. This might sound crazy but I quite enjoy having a conversation with the rustc error messages. I would never have expected error messages to be anything but annoying and inscrutable.

Meanwhile my stance on requiring international standardization has softened. C++ has that but it has not stopped the ongoing train wreck that is C++ feature bloat.

As for multiple vendors, I'm confident that there will be a Rust front end for GCC at some point.

The only thing I don't have is Rust in the browser. But that seems to be coming along nicely as well.

I could also on about the wonders of Cargo, the crate system, the amazingly helpful community here and so on. I will leave that to others...

8 Likes
  1. I love static types and having a powerful type system, which makes refactoring code way safer and more relaxing. Rust's type system is lovely, and makes for beautifully structured code.

  2. Also the integrated testing is wonderful.

Together these make programming very relaxing.

5 Likes

As an embedded developer I came across some quite painful memory bugs, most of them due to buffer over-reads after changing something small, which took a long time to debug. After i accidentally came across rust - and his memory safety - i was willing to learn this new language. Especially since it also has an excellent "platform independence" and is also available for ARM and RISC-V, thus providing an alternative to C and Cpp. In addition, these security advantages come without a runtime penalty, which was another important reason for me.

1 Like

A very nice point of Rust I think is that I can gradually apply functional concepts such as map, filter and so on to my code without being forced to do so (as would happen in a purely functional language such as Haskell). Solving Advent of Code like this is a lot of fun, and if I struggle with something in functional style, Rust lets me write as much as I need in the good old imperative style. This makes for a wonderful learning experience of functional concepts!

7 Likes

https://pastebin.com/vX81pVdb

I got into Rust because it's the only language that checked all the boxes.

1 Like

First real interest was caused by stackoverflow survey - a couple year ago it was "most loved language" (and it's still now fourth year in row). So this definitely brought my attention - what it was that had risen Rust to that position. Why people said I want to program in Rust more then in any other language.

After researching a bit about Rust I thought it would worth to learn the language. In those day I was working mostly in Python (and Javascript plus had some sideways experiences in OCAML to get more exposure to functional programming, before I was working mostly in "classical" OOP GC languages - C# and Java). Python is cool, you can do a lot of things quickly and easily, but frankly spoken it's performance sucks. So going back to statically typed language and system programing sounds like good learning exercise and I hoped I would be able to program highly performant code with a modern language. I have to say I do not regret effort invested into Rust - it is a great language (with outstanding community) and I learned a lot. This "ownership" aware thinking was quite inspiring and helped me also in other languages.

3 Likes

So I finally remembered what it was that steered my attention to Rust. As I said previously I had made a decision some years back never to learn YAFL (Yet Another ...) again. Having wasted time and effort having to learn a dozen or so languages over the decades, I decided C, C++ and Javascript (node.js) was going to be enough to do anything I might ever want to do till the end of my days.

What it was was a presentation by Bryan Cantrill: The Summer of RUST https://www.youtube.com/watch?v=LjFM8vw3pbU or perhaps this one: Statemaps in Rust https://www.youtube.com/watch?v=aWbGPMxs0AM

Well that totally grabbed my attention. Here we have a well known developer, an old hand of Unix internals at Sun, I guy who has lived and breathed C for decades, a guy for which performance is key explaining how great the safety of Rust is and how he was stunned that his Rust version of some program was faster than the C he could write!

Then I got wind of the fact that the likes of NPM are starting to use Rust in their javascript/node.js package repository service. Hmm... what? You mean I can do in Rust what I normally use Javascript for? I only need one language to everything? Tell me more!

The final push was the fact that us few guys, let go by our former employer, decided to start a new company to pick up one local project the old employer had dropped. We needed to reimplement a lot of similar functionality to what we had been working on for years. We were worried that the old employer might want to take action against us for 'borrowing' their code. We decided that writing everything from the ground up in different languages would be a sure way to be sure they had no such claim.

At that point Bryan Cantrill showed up and pretty much made the decision to use Rust for us.

So far I'm amazed how well it is going. Rust replaces C++ for some performance critical parts. It replaces node.js for web server, REST API, websocket server and the like, all the while not being much harder to write than JS and inspiring a lot more confidence in it's robustness.

4 Likes

Short answer: memory safety built into the compiler without using GC and performance on par with C/C++ code.

3 Likes

I often implement custom algorithms for numerical optimization (I research new statistical learning methods). When I finish a toy example in Python but I can't escape heavy looping, I used to implement the big example in C. This would take ages because I would mess up some convoluted vector indexing trick and the code would just compile and then segfault (if I was lucky). I did not even bother with parallellization.

Then I read about Rust (I guess on Hackernews) and I was instantly sold. during the learning process understanding the concept of lifetimes and ownership became reasons of their own to study Rust.

After I finally got a hang of lifetimes and ownership, the list of reasons to use Rust kept growing. I sometimes even use Rust instead of Python for exploratory work, simply because the borrow checker helps me prevent silly errors like duplicate variable names (my creativity runs dry around the tenth counter) or using global instead of local variables in a function because I reference before I assign (that one is Python-specific I think).

Long story short, I am far from perfect as a programmer and Rust points me to my errors in a friendly manner whereas other languages throw run-time errors in my face, or worse, have undefined behavior.

4 Likes
  1. No null
  2. Thread safety
  3. No JVM
  4. Explicity
  5. Performance
  6. Expressiveness / high level constructs
  7. No exceptions
1 Like

I'm interested in the robust type system in a compiled, imperative language that doesn't run on the JVM. I'm sure there are other possibilities that fit this description, but Rust seems to have more traction than anything else I've seen that fits this description. Recently I've done a lot of Go, Javascript, and Python, and I feel like Rust fills in missing bits of those languages.

edit: To be more specific I'm more interesting in using the type system to model complex domains than in it's ability to prevent memory issues.

1 Like
  1. Feedback from StackOverflow users that elected Rust as their favorite language.
  2. After doing first tests I realized how performant it was and then I decided to learn more.
  3. Also because of the level of control in the low level
  4. Functional way of solving things in Rust also attracted me very much and was decisive to make me reserve time to dive deeper in the language
1 Like

After starting to learn C++ to contribute to MuseScore, I started watching C++ conference talks on YouTube.

Then, YouTube decided to put the talk Is it time to rewrite the OS in Rust in my suggestions. I was intrigued. What was this Rust thing?

I started to realize by that time that there were a lot of languages over the years trying to replace C/C++ in low-level stuff, and I thought I'd watch it anyway. I was pleasantly surprised. The speaker said "It depends. Don't rewrite everything at once, but do rewrite certain safety-critical parts, and any new stuff." So I started investigating further. And here I am today!

3 Likes

This is what has kept me learning Rust, the compiler is surprisingly helpful and friendly.

As for why Rust, I am very new to programming and don't want to learn old languages. I have enjoyed learning javascript and C# in class but I always find myself interested projects that are C++ based. But as a newb C++ is extremely obtuse and illegible, whereas Rust seems almost conversational; so given the choice I have decided to tackle Rust as I feel it will prove useful.

2 Likes