Rust in 2017

Maximilian Stroh
4 min readDec 29, 2016

Recently Steve Klabnik called out to summarize why Rust is actually awesome to work with. I do love Rust and plan to use it next year for many many things, so I want to share my thoughts about the language, where it excels at right now and what is needed for critical breakthrough success.

Great language features right now

The more I use Rust, the more I recognize things that are flat-out awesome in Rust. But some things might be of special interest for readers who are not yet using Rust:

  • It’s a compiled language with a great type system. After having worked with Ruby, PHP, Javascript and a few other scripting languages, it’s liberating when you can refactor bigger codebases without the fear to break stuff. You also don’t have to write these enormous test suites to cover basic stuff, which is a huge productivity boost in the long run.
  • Getting started just got very simple thanks to rustup. If you come from Ruby knowing RVM or rbenv, this is should be very familiar.
  • Deployment is as easy as it gets: you can cross-compile your binary/library to many target architectures and ship a single file. Similar to Go, but the package management/vendoring story is way better thanks to cargo and rustup.
  • The documentation is hands down one of the best language documentations I’ve ever seen. I find myself reading stuff like prose and learning things about new topics all the time, when I originally just wanted to look up a function during coding.
  • The Performance Story. It’s in the same Ballpark as C/C++ (sometimes faster, sometimes slower). While this isn’t particulary interesting in most cases, sometimes performance is an important factor when you choose technologies for a project. Actually more important is the fact that this increases developer productivity, because you can skip extensive profiling/performance-tuning after you have written your first code iterations.
  • Syntax and core Features. After months of coding (micro-)services in Go, it is extremely pleasant to have generics (instead of copy-pasting code or interface{}), also iterators are much more comfortable than only having “for”-loops available. And much more things I won’t enumerate here…
  • Great books available online, for free and up to date. “The Book” is written with people in mind that didn’t do programming on lower levels before, so it is very approachable and teaches everything you need for most daily tasks. If you need to get really close to the metal, “Rustonomicon” has you covered, too.

Usecases right now

In my mind, there are three major usecases for Rust right now, where it can really excel. Yes, there is Mozilla, building a next-gen browser with it, but I have zero experience with this or any motivation to do the same thing. These usecases are primary what I think of and use Rust for:

  • Libraries. I tend to rewrite a bunch of personal libraries for every new programming language I learn. Maintaining this stuff for languages I no longer use is a burden, really (aka: I don’t find the motivation, ever). But once I’ve written libraries/algorithms in Rust, I can use it from all other languages/projects as a native extension. Being written in Rust, a library is highly performant, reasonably correct and doesn’t have nasty exploits like C/C++ (mortals don’t seem to be good at writing exploit-free C++, see decades of bugfixing unix-y stuff). So write it once, and then call it from Node.js or Elixir or whatever you use currently.
  • CLI apps. Bash gets unreadable after a few hundred lines, Python/Perl/… require installed runtimes (which average windows colleagues do not have). While other compiled languages like Go/C++ can be used here, doing “scripting” tasks in Rust can feel very natural due to its high-level yet familiar syntax features.
  • Small Web Apps/Services. You even have the choice what is most important for you and choose the matching framework: do it quick, do it composable or do it safe and fast. After having to maintain PHP, Node.js and Go stuff, I now prefer the last one, by far. Prototypes are never thrown away and done “right” when you work in corporate environments, so do it right from the get-go or pay the price later down the road (~20% longer initial development time vs multiple times maintenance costs, bugfixing and emergency calls at 3am).

Required Features for new Usecases

Rust currently ignores the needs of the majority of all developers I’d say.

  • Do you know what enterprise-y developers do all day? Shuffling data from SOAP-Services around, maybe analyzing them, maybe creating reports for Excelsheets for managers. The thing is, Rust could use WSDL definitions for the SOAP-Services and generate safe abstractions for it (using the great type system) to use with ease. If using Rust makes dealing with all these SOAP stuff dirt-easy and painless, corporate developers will (silently) start to use it. Database needs are already covered, Excel can be dealt with, and CSV is easy.
  • A (probably) minor thing that would make big splashes: Let Cargo compile libraries to other language formats directly. Currently one has to use one of the (excellent!) language wrappers like Neon or write FFI interface code manually, I think this could/should be abstracted away entirely with cargo. Hiding those “ugly” details from developers just trying to write an efficient business algorithm and use it with FOTM language within company context could play around easily, leading to major improvements not just for rust’s ecosystem, but for all other included languages, too.
  • And lastly: as always there is a need for a big, highlevel web framework like Phoenix, Rails or Django to really take off. I assume once Tokio gets Futures/Async-IO right, one can build a truly high-performance foundation for such a framework, which is also safe. Add the usual code generators, DB migrations, Routing, included user-accounts management and a dead-easy deployment story, done. Rust (with popular crates) already provides the “hard” stuff, the focus here needs “just” to be developer ergonomics and polishing, something that the Rust team and especially Steve Klabnik excels currently.

This is my personal wishlist for Rust in 2017, obviously. I’d love to read opinions from other rustaceans out there!

--

--

Maximilian Stroh

Describing myself in buzzwords: #FullstackDeveloper. #DataScientist. #GrowthHacker. #ProductDesigner. #Meteor monkey. #Elixir Alchemist. #News addicted. #Zen.