Rust is a systems programming language designed to be safe and fast, both very useful things when writing a production web service. I needed to parse some output from the popular Logentries platform, so I sat down for a few hours and wrote a small service in Rust to fetch and parse the data, and feed it to our internal dashboards.
Rust is surprisingly pain-free to work with for such a low-level language, partly due to its package manager Cargo. Cargo makes it incredibly easy to set up a project, install dependencies, and compile and run a program. As a very quick how-to for the tech-heads out there:
cargo init --bin
will set up a skeleton project for you, then
will compile your project, install any dependencies from crates.io and run your program.
Coming from Node, the type system can be quite abrasive at first, but after a while it becomes pretty natural to use and, in my opinion, far better than a loosely typed language. I used to write quite a lot of C so perhaps I’m biased.
As this is a long-running service, it’s important that it be reliable. To this end, Rust’s explicit error handling mechanisms make it very easy to give the program sane defaults in case of an error instead of segfaulting like C might. Not having to babysit a service (as much) means a reduced maintenance headache for developers, as well as more free time to do other cool stuff. This obviously has beneficial implications for any business – time is money, after all.
Overall, I’d say this experiment has been a success as a non-public production app. Rust is good for small, production-ready services right now, although key parts of a larger system like a mature database ORM are still being developed by an active and rapidly growing community. Could this be a new era for TotallyMoney.com? Move over Node, Rust is coming…
This is a brief summary about using Rust in production at TotallyMoney.com. If you’d like a more in-depth write-up of the Rust code and how it works, check out the original post on wapl.es.