back
135 comments
Great to see people found my article interesting! I wrote it after I was asked by a company about the possibility of helping them by contributing to some open source Rust projects. During the conversation I tried to explain my involvement in the community, but I noticed the story wasn't that fresh in my mind. A few days later I decided to research it, write it down and publish it, because it might inspire other people to contribute and also because there might be other companies willing to bring an old contributor back, if they only knew
It’s a great read!

Maybe you can combine Rust and Elixir by speeding things up with Rust NIFs.

Haha I have certainly thought about that possibility ;)

You can do incredible things with little effort thanks to Rustler

I know Rust is very popular right now but as a back-end dev I always wondered what's in it for me. I never had to write programs where garbage collection was a problem and learning a whole new paradigm (borrow-checking) just seemed unnecessary. And it seems like it is a language that is more difficult for junior developers than almost any other one. What does Rust solve for the casual user?
> What does Rust solve for the casual user?

If by casual user, you mean the 95% case of a back-end developer whose main job is pulling data from various sources, performing operations, and placing that data elsewhere and/or displaying it to an end user: nothing, really.

Rust excels at performance, but the bottleneck in modern web apps is going to be IO, whether that's loading data from a database or from a third-party API you're integrating with. Rust excels at correctness, but your errors are going to come from bad data and system outages which require manual intervention anyway. Rust excels at security, but if you're using a GC language running on a Docker container on an ephemeral cloud instance, the kind of security Rust provides isn't a likely attack vector for you.

All that being said, Rust is a great language! It just has its niche, and that niche is not the typical web-dev back-end work that most developers do these days. As others have said, you'd use Rust in the same situations you'd use C++: building a database, building a web server (like nginx), etc. If you're just building a web app that talks to a database and serves HTTP responses, stick with Python/Ruby/Go/PHP.

> but the bottleneck in modern web apps is going to be IO

This is true in some senses, but also, response latency isn't the only thing a web application does or is evaluated by. Many applications have, for example, background jobs, that do arbitrarily complex processing outside of the request/response cycle.

Additionally, people who write web services in Rust talk about decreased memory usage, consistent memory usage, and lower CPU usage. In a cloud context, that can translate directly to revenue saved, by spending less. If that tradeoff is right for you depends on a variety of things, of course. "speed" isn't the only relevant metric that you may want to optimize for.

One big advantage to developing in Rust that I have found over other languages is that you _must_ handle error-type conditions; for example, if something returns an Option or a Result you need to check that it was successful in order to extract the value.

This means that you don't accidentally forget a null check (or a catch block) and, in my experience leads to software that is a lot more robust.

Even if all it is doing is pulling from a database and munging it into JSON.

Rust has a well designed macro feature that can make it easy to add custom domain-specific syntax for use in Rust programs. We shouldn't underestimate the impact of that as a productivity enhancer, it's getting a lot of use already in Rust web-backend stacks.
In my experience with PostgreSQL, using a connection pool and proper indexes can outperform Python or Ruby execution speed by an order of magnitude.
So I deeply love rust and it's my goto even for applications that it's not especially well suited for. I just know it well and it's easy and natural to work in. It's a flexible language so it plays well in a lot of use cases even outside the ones it excels most at.

With that said, it's okay if there isn't much in it for you. If it doesn't sound useful for your current use cases, that's okay. Don't use it. Use things because they are interesting and fun or because they make your life better. Don't feel the need to use it just because it's on The Orange Site a lot.

Rust is very much not a replacement for writing a program in a language that would have a garbage collector. It's main niche is making C++ obsolete, so categories where either resources are limited due to there just not being a lot of resources available (embedded) or are limited due to you needing to squeeze as much performance out of your machine as possible (OS, drivers, numerical computing, maybe someday video games).

It's probably not a good first language, but neither was C++: that's not its niche.

Even for embedded and other systems programming context automatic memory management via ref-counting systems can perform as well or sometimes even better. I found non-atomic ref-counting to be fine for embedded. For truly small programs I'd rely more on compile time computations which Rust isn't actually great at vs Nim or Zig, or a bunch of others.

Actually both C++ and Rust tend to make heavy use of reference counting via `std::shared_ptr<T>` and `Rc<T>/Arc<T>`, respectively. Personally I think that while Rust's borrow checker is nice for some cases and does encourage fast/efficient memory usage, it's also overkill vs automatic memory management for even most system or real-time programming. Especially as compilers get better and can remove 90% of the reference counting spots.

I expect that Rust will include opt-in, pluggable GC at some point. It's effectively a hard requirement for programs that have to work with possibly cyclical references. (You can use weak references as part of refcounting in some cases, but it's not a fully general solution.)
Don’t forget about WASM
This is a vague sentiment so it’s okay if it doesn’t mesh with you, but I like Rust because it’s a great example of language design done well. I’m not claiming Rust did everything right but I’d say it’s a great example of programming language design that manages to balance theory, practice, user experience, tooling and safety. I think any developer can learn a lot from Rust’s design. Including what not to do!

Also it’s just plain fun sometimes. I love expression based syntax where you can assign to an if or have a block result in a value. It just feels delightful. The standard library is very constrained but within those constraints it has a lot of wonderful depth. Functions like split_once or unwrap_or_else are delightful to use. It gives me that same feeling as Ruby where the language feels designed to have you enjoy writing code. The language has all of the requisite tools I want to model data structures including tuples, structs, and enums. It’s great! Try it out and see for yourself

I like rust, but wouldn't recommend it in my enterprise shop. I don't know what language you are used to, so I will suggest some things that you might enjoy learning about.

In languages without spread operators (like java), immutable objects are quite clumsy to work with: I want this same object but these two fields changed (like the replace method on python's named tuples, but those are also annoying...). But with mutable objects, everyone can mutate: chaos. Rust gives you the mut keyword, structs are immutable by default.

Ever wanted to implement a method on a class in another library that just used the public API? Just make your own Trait in rust.

Ever wanted to make sure that someone would call `close()` on your implementation? Ever wanted to make sure that no one would use the object afterwards? That's garbage collection of a resource that isn't memory, most GC languages won't manage that for you, but the borrow checker will.

Pattern matching, algebraic data types, expressions and statements distinctions, an excellent build system, procedural macros, no null, no exception handling, good type inference; none of these are new or unique to rust, but lots of languages lack a few to many of them.

But yeah, some times I don't want to decide between monomorphisation via generics, or heap allocating for dynamic dispatch. Some times I just want a JIT and a garbage collector to take care of that for me. But that is another thing rust might give you: a newfound appreciation for what you have.

The replies here are all good. I would add...

A feature of modern computing is the use of very low power systems (I programme mostly for Raspberry PI - not very low power) and/or systems run on "pay as you go" platforms which can scale hugely.

Rust is very efficient at run time. (Not at programming time nor compile time) so is very useful in these cases.

A counter example, from my life, to illustrate: I ran a mail server for a group I was involved with. I spun up a VPS and Mailman. (Mailman v3 is built on Django/Python). I had to double the capacity of the VPS as 500MB of memory was not enough to install and run Mailman (I think the problem was at install time, but that made very little difference). The cost of my mail server doubled because of the inefficiency of the Django/Python framework.

Django is very efficient at programming time, but is resource hungry. The original Mailman ran in 40k, the "modern" version was not usable on a platform with 500MB.

For me it was no biggy. One server, $10 not $5 a month. Mēh! But if that were a million instances.....

So with all the progress in computers getting more powerful the actual instances we use are getting weaker (for very good reasons). A language like Rust can be very helpful in this case.

(On the Raspberry Pi I use Rust for realtime control of audio processes)

Many reasons actually. The tooling is excellent (builtin package manager, test suite handling, etc.) The language itself is also very good in that it prevents you from doing many mistakes you'd do in other languages. It's hard to show an example when you don't know Rust at all, but usually Rust programs tend to have less bugs than others.

That being said, there are also downsides - apart from the steep learning curve, compilation is pretty slow and the language itself isn't as good as some others for prototyping - if you make something simple and want to go fast, then maybe TypeScript will do a better job, despite its numerous problems.

Rust is more about robustness and correctness (and performance of course). If these are not appealing to you, then sure some other languages like Java, Go, C#, TypeScript or others can do the job.

My day job uses the JVM heavily. I don’t have issues with garbage collection and don’t mind the languages to much.

I’ve used a bunch of common languages, Python, JavaScript, Typescript, PHP, Bash, Go etc. Not so common languages such as Haskell.

My first choice for personal projects is now Rust.

The memory/borrow checking to me is just a nice benefit I get from using Rust, I don’t use Rust for the borrow checking.

My main reason for Rust is while it’s not as high level as say Java/Python etc I find it is still at a nice level to work with and can be far more expressive with the enums, traits and generics.

The second big reason I use it is my programs end up fast and efficient with little effort.

The third reason is I can get tiny statically linked binaries that just run anywhere with no dependencies.

Reasons two and three mean I can host my applications on the cheapest, most minimal resources available and still outperform other languages on more expensive hosting. Currently my choice is to stick the binary in a Docker image which ends up sub with a sub 10mb docker image then deploy on the smallest 128mb AWS lambda and pay fractions of a cent to host. Services that need to be long running go on the smallest $5-10 vps’s .

The borrow checker can be a pain however I find the compiler error messages really helpful in it often tells you what you should do to fix the problem with plain English error messages and code suggestions.

I have written another comment for a similar question, so I will paste that below:

---

I'm not sure I agree with the article's premises. Rust can be difficult, yes, but it can also heighten developer productivity above other languages. In Go, I'd have to worry about whether I checked for exceptions via `if err != nil` everywhere, while with Rust, I can depend on the compiler telling me if I haven't done so exhaustively, via the Result type. Same for having algebraic data types or, well, generics in general.

I will also push back on other commentors here saying Rust is not good for web apps and APIs, and I have found that to be the opposite of true. I read Zero To Production In Rust [0] (a great book by the way, all about creating a web API with actix-web and Postgres) and deployed an API that has not gone down a single time since deploying near the beginning of this year. It's as ergonomic as (and sometimes even more so than) any NodeJS or Go API I've made (as even though Rust doesn't have function overloading, actix-web and others have some macro magic they do behind the scenes to make it appear as if it does), and there were very few times I had to contend with the borrow checker. If there had been and if I were really going for speed, I would also have cloned everywhere that was needed.

When I write something in Rust and it compiles, I can depend on it to work, and to continue working. At the end of the day, use the tool that makes sense for your business, but I don't think Rust was necessarily a bad choice based on my personal experience with it.

[0] https://www.zero2prod.com/

---

From: https://news.ycombinator.com/item?id=33714007

Personally, I'm finding myself reaching for C# to solve most problems I come across. Rust is appealing to me on a more theoretical level (or when there is a domain where it truly shines, such as concurrency or C-like performance).

IMO the strengths of the language are not a deal-breaker for a casual user (e.g. someone writing CRUD or line-of-business applications)

Not using Rust is also OK. I don't know Rust web stack enough, but my impression it's sometimes used to reduce AWS cost and decrease latencies, with some success.

But doing a rewrite requires Rust programmers and they hard to hire.

If you write Rust + Actix/Axum for backend, you'll never even see the borrow checker [1].

Rust is quickly growing into Golang and Java's space for web services.

My startup uses Rust in production for our web APIs, and we're really happy with it.

[1] You'll probably need to spend a few hours learning the language basics, but it's really easy at this point with the docs and best-in-class compiler error messages.

So it has a steep learning curve and it's not the "best" choice for people's first couple of projects.

But, before you can make anything meaningful with a language, you have to first make many toys. That's the rationale for using it in cases where there are better alternatives. (To make you comfortable using it when there is a need for it.)

It’s hard to say without knowing what exactly you’re comparing it to.

Because I already know Rust, and prefer it as a language generally, it’ll be my default choice, just like you have your default choice. It works well for many cases in the backend, but not all of them, like lots of technologies. If you don’t find a compelling reason to switch, you shouldn’t!

Learning (and I still am) Rust was great for me. I feel like it teaches good practices that you can also use in other languages and also it forces you to understand “how things really are working underneath”. That’s why it’s hard in the first place, but don’t put it in a corner just because of that.
As guy who has very similar background just like you: there is very little in Rust that will benefit your straight away. On the other side, you are going to learn a lot about low level details associated with systems programming (mostly influenced by C++ in case you are learning Rust).

For me the biggest win with Rust is the performance that I can get out of it, which is irrelevant in most cases. If you work on a problem that requires extreme single node performance then you can learn Rust instead of learning C++. This is probably less than 10% of the use cases people use programming languages for. As far as teaching juniors: I had great success with Python, yet, a lot of foot-gun situations. With Rust I am not good enough to mentor our junior devs, so we learn together. It goes very slowly.

It doesn't. Use C#, Java, or even python. If you're low level and dealing with low level code and constructs, you're better off using C, or C++ just for the language features like templates.

Rust is genuinely only useful for the niche application of a desktop application, that doesn't reach low level, but you need a bit more fine grain controls than C# or another higher level language will allow. For example, a web browser is like the ideal usecase for Rust, and it makes sense, since that's really where it's got most of it's teeth with Mozilla.

I personally don't see why you would do something like Grep, in Rust, when C#, Python, Go, exist. But I do see like Unreal Engine or again, Firefox/webbrowser in Rust being nice.

Honest question, but I don't seem to understand the base context of what you're saying. If you're a backend dev, you care more about performance than a front end dev does. That's why backend devs generally write software in something like C or C++ where Rust would play in perfectly. However those languages have security issues and trade that off against performance Why would you say that Rust has no relevance to a back end dev when from my understanding Rust is THE perfect language for backend devs because it maintains the speed of C and C++ but adds security? What is the context that I'm missing?
It's completely okay for rust not to overlap much with your work. If you aren't doing a lot of systems programming type jobs it's probably not all that applicable to your day to day work. If you're interested in systems programming then you might look into it. Seems like Java or typescript or ruby|python|php would be more up your ally and I assume you know one or more of those as a part of your work.
I think the popularity is helped by the fact that it's rarely useful in the day job for most people. You can have your Rust tinkering and there's a natural moat between it and work. It also automatically throws the safe and useful seemign borrow checker puzzles at you that don't involve the outside world.
Rust is my favorite language for embedded and writing desktop programs, including 3d graphics.

For backend web dev: Skip it. I prefer Python/Django.

Define casual user :)
Thanks for the mention Adolfo! Never knew that I was in the causal chain of your journey to Rust. Hacker News is definitely a gateway to random experiences :)
The Rust community is easily the worst thing about Rust. The constant preaching and cult-like reaction to any criticism is very offputting.
I've had quite the opposite experience in fact. You can find numerous topics on places like r/rust where people talk about the downsides of the language compared to others (for instance).
Even if you have some legitimate grievance, this sort of incredibly vague complaint tells nobody anything, it's completely uninteresting.
I've found there are two entirely different worlds within the Rust community.

Rust does attract a weird subgroup of people who can get preachy and pushy about there only being one way to do things.

But the helpful part of the community is much bigger and much better to work with. You just have to look past the loud people pushing agendas and stay out of flamewars on Reddit and HN.

> The Rust community is easily the worst thing about Rust. The constant preaching and cult-like reaction to any criticism is very offputting.

I've seen more comments talking about this supposed phenomenon than instances of this phenomenon actually happening. I haven't really seen any examples of preaching and cult-like reactions, I just see people talking about how it supposedly exists somewhere.

I've noticed a very big difference between comments about rust on general programming sites like here and /r/programming and comments in rust specific spaces. I find people in rust-centric spaces to be calm, reasonable, kind and pragmatic. Some of the worst rust evangelism I've seen comes from posters who I'm not even sure have written serious amount of it.

I agree with you that it can be really off-putting. From my perspective what you are seeing could be more of a comment on some of the know-it-all dilettante types who fawn over trendy tech in comment sections than the rust community itself. I've always had great experiences when reaching out for help in discords, user forums or other spaces. I've seen similar patterns with other trendy technologies in the past too.

At some stage there was a squad on StackOverflow who closed all Rust related beginner questions and it was impossible to get started. Most devs new to Rust do not understand &str and String and 99% of the content about is how implementation details backing those types are different. I have not seen any blog post, documentation about how and WHEN to use &str vs String.

I want to have a function that returns the UTC now as a string. Now what? Opening a question on SO -> question closed, here is a question about &str and String that has nothing to do with the use case and everything about the implementation details of &str. Good stuff.

I think the creator of Rust assume that if they explain where a piece of data is allocated suddenly everybody is going to be on the same page about the use of that data.

Having been moderately involved in it, that isn't my impression. They were a helpful and informative bunch, and I learned a lot from them.

That said, being an outsider, I'm reminded of this quote from a recent article:

> "What was the deal with [person X] on your team, why are they such a jerk?" (Sadly, if you worked on Chrome you probably know exactly who I'm talking about.) The experience gave me an appreciation for how a group, especially a faceless internet group, can be perceived by its worst behavior.

Source: https://neugierig.org/software/blog/2022/12/chrome.html

My personal bigger issue is that at least some parts of the "community" often has a very harsh left to far-left swing to it that I've run into a couple of times that reacted with explosive hatred toward me when they realized I wasn't one of them. Yes I have some right wing views, I still want to use Rust though, but that doesn't mean I should feel forced to adopt your personal brand of far-left progressiveness. I hope that will even out given time.
It's kind of unnerving there even is a community as part of a programming language. I learned C from the K&R book and an old Russian guy.
Same for the Go, Python, JS, Java communities. People will always try to “defend” what they like one way or another.

Also, what can you criticise about Rust? /s

>The Rust community is easily the worst thing about Rust.

Completely agree, but for a different reason:

The community and leadership is overran with woke leftist types. It's insufferable.

Yep. Just search “borrow checker” on their subreddit. Any post pointing out an instance where it makes things overly verbose and complex is immediately met with downvotes and “why do you need to do that”s.
As someone else has stated, you have not said anything of value here and are just vaguely screaming into the wind. Do you just find people being highly enthusiastic about something off putting? If so, do some introspection.