Hacker News new | past | comments | ask | show | jobs | submit login

As someone who wants to use Rust for real world applications, what are some good use cases for Rust? Web development is not its strong suite, apparently.

Or, better still, what have you personally built using Rust?




I feel like rust has some good sweet spots right now. I care about these but maybe not everyone else does.

- Parsing untrusted inputs. nom[1] is a joy to use, and lets you kind of effortlessly and fearlessly process random input from wherever and turn it into useful data structures. If your data is very regular or in a standard format, then serde[3] is very hard to beat if it just boils down to 'derive(Deserialize, Serialize)' on your Rust struct.

- Bulk data processing. rayon[2] makes pegging your machine easy if you have a lot of work do to, and the Rust semantics around thread safety, data ownership, and explicit copying make it kind of trivial to reason about how your data gets from input to output and tuning it to be crazy fast.

- Generic systems language. Maybe this one is personal, but I find it's more productive to write generic cli applications and whatnot in Rust over C, ruby, or python. There are some nice libs to make part of this pleasant (structopt[4]) but this really boils down to reliability. Because Rust makes it obvious where things can fail so I can deal with it I have way higher 'just works' outcomes in Rust than other languages. I might spend slightly more time making it compile, but I spend basically zero time debugging runtime failures and this is kind of indescribably amazing.

[1] https://docs.rs/nom/6.1.0/nom/index.html

[2] https://docs.rs/rayon/1.5.0/rayon/

[3] https://serde.rs/

[4] https://docs.rs/structopt/0.3.21/structopt/


I've used Rust to write a couple of personal projects: a compiler for a language I've designed (it's really good for that because of its great ADT and pattern matching support) and a small CLI which I wanted to be very fast. Rust is great for that. The `structopt`[0] crate makes writing CLIs almost as easy as on a high level language.

The other project is a web app and I use Rust to compile to WASM. Because I had to use several web APIs (DOM, WebCrypto) I used the JS interop heavily, and that's still very painful to use if you use the low-level interop (js-sys and web-sys)... however, I am aware of several efforts in this area, like Yew[1], which should make things better.

The language is very hard to learn, but once you get past a certain threshold (depending on what you know already, that may take weeks to several months) it's really nice to use (though certain things are still hard to write because managing lifetimes can be very tricky).

[0] https://crates.io/crates/structopt

[1] https://yew.rs/


I built a tool that generates personal code coverage reports from general test code coverage and repo inputs. IE what is the code coverage on lines I wrote this sprint and lines I wrote ever.

It stores blame coverage data in an sqlite db and generates static html reports for easy deployment. It handles TS/JS (lcov) coverage natively (I have to parse the files with SWC to figure out what lines are parseable). It has to dish out to a small jar to extract jacoco coverage.

It takes about an hour to do the initial data population and can generate an report and update test infor in 5-10 minutes for a roughly 600K loc codebase. Sadly it's closed source at work.

I'd been kicking around the idea in my head for a bit, and when I got the go-ahead from my boss I was able to bring it to completion fast enough to surprise my boss.


It's a good thing I didn't get that memo, nor anyone to tell me that backend web development wasn't its strong suit, because I built an entire platform of services with it and an EDA. As I worked on my projects, I wound up crossing streams with developers who had moved from Node, Python, Java, Ruby, PHP, and Go.


I mentioned elsewhere in this thread that I built a jigsaw puzzle website [1] with a Rust API backend and I launched it last week. It definitely took longer than if I had used Node, but I enjoy working with Rust much more.

Apart from that website, I have also open sourced a Rust CLI task runner [2] which uses markdown files as a command definition format. This is probably the most important tool I've ever written, as I have used it every single day since.

[1]: https://puzzlepanda.com

[2]: https://github.com/jakedeichert/mask


Some off the top of my head are Alacritty (terminal emulator), exa (ls alternative), bat (cat alternative), and dog (dig alternative). Discord is rewriting a lot of their services from Go to Rust [0]. I personally built a CLI text editor in Rust [1] (very early development).

[0] https://blog.discord.com/why-discord-is-switching-from-go-to...

[1] https://github.com/andrewkdinh/via


Small erratum: Your first link describes re-writing a back-end service from go to rust; the first-party Discord client is Electron.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: