Absurditas Demens

Collection of personal tips, documentation, and more.


Project maintained by compenguy Hosted on GitHub Pages — Theme by mattgraham

Rust

Lately, I’ve been learning Rust.

Why Rust?

Because it’s like C, but adds memory and concurrency safety, and adds the structure of OOP-like programming.

Because it’s like C++, but adds memory and concurrency safety, and boils down OOP to its bare essence making it a lot simpler and harder to screw up.

Because it can be used runtimeless, making it suitable for kernel-mode use and in deeply-embedded systems. There’s even a crate for intrusive datatypes.

Because semantic macros require less mental gymnastics and fewer WTF moments.

Really? Sounds more like hype.

Yeah, a little bit. Rust is still pretty young, and it’s trying out a number of fairly new ideas. That doesn’t mean isn’t useful for real work, though.

Rust was basically invented to be the foundation for Mozilla’s research browser engine Servo. Servo recently hit two milestones: converting portions of the shipping Mozilla browser to use their rusty Servo counterparts instead, and benchmarks of very complex javascript demos between browsers showing servo hardly breaking a sweat.

Dropbox has been porting performance-critical (especially memory-critical) portions of their infrastructure from Go to Rust.

Tor extensively evaluated a move to either Go or Rust, and settled on Rust.

npm, coursera, Samsung SmartThings - the list of major projects standing behind rust is growing longer. There’s even a game on Steam written in rust.

And Rust is not perfect. Writing unsafe code can’t always be avoided. There are some degenerate cases where leaks are possible. Very few batteries included - instead of a rich standard library system, it relies on the crate ecosystem, a darwinistic environment of rapidly-evolving choices, although people have been making efforts to collect and advertise important crates that are high quality and stable.

How to Rust

My Rust Projects