Inside Rust at Embark 🦀
Tags: rust, opensource, gamedev
Published: 2020-02-24 10:50:24

---
title: Inside Rust at Embark 🦀
published: true
date: 2019-12-06 14:19:10 UTC
tags: rust,open-source,gamedev
canonical_url: https://medium.com/embarkstudios/inside-rust-at-embark-b82c06d1d9f4
---

## A peek inside our day-to-day work with Rust and open source game development

_Originally published on our [Medium blog](https://medium.com/embarkstudios/inside-rust-at-embark-b82c06d1d9f4) on December 6th, 2019._

![](https://cdn-images-1.medium.com/max/1024/1*WZD6pIxwslRlf9LpMk8tpw.jpeg)

As you may know, Embark has used [Rust](https://www.rust-lang.org/) as our primary programming language since the day we started the studio. We love the safety and robustness of Rust, and the ability to write high performance, safe, and (mostly) bug-free code. It enables us to fearlessly refactor and change the code, without common lifetime/ownership, memory safety, or race condition problems.

![](https://cdn-images-1.medium.com/max/1024/1*NX1OvvwAyWaMCwmx15nCZA.png)<figcaption>Our first open-source Rust projects, available on <a href="https://embark.dev">embark.dev</a></figcaption>

A possibly even more important reason we love Rust is the openness and collaborative nature of the ecosystem, and the growing community around the language.

With tens of thousands of open-source crates on [crates.io](http://crates.io/) and the best-in-class package system _cargo_, we truly believe Rust is a language for the future.

Last month, we hosted a [Rust meetup in Stockholm](https://www.meetup.com/Stockholm-Rust/), where Embark software engineers spoke about our work in Rust.

#### Rust, Open Source, Game Dev

[Jake Shadle](https://twitter.com/ca1ne) gave an overview of how Rust, Open Source, and Game Dev fit together, and why they’re a powerful combination.

{% youtube lpOg2nl3kr0 %}

#### An unholy fusion of Rust and C++ in physx-rs

[Tomasz Stachowiak](https://twitter.com/h3r2tic) dove into the technical challenges he encountered when combining Rust and C++ code to make the [physx-rs open source project](https://github.com/EmbarkStudios/physx-rs).

{% youtube RxtXGeDHu0w %}

You can watch both talks in full on [our YouTube channel](https://www.youtube.com/c/EmbarkStudiosAB)!

I sat down with both speakers to get an inside peek of what it’s like to work with Rust at Embark, and their vision for Rust in 2020.

#### How long have you been writing Rust, and what got you into the language?

**Jake:** I looked at Rust one time before 1.0, but I was on Windows so the install experience was…not nice. Actually the install experience shortly after 1.0 for Windows was also not nice, my first and only PR to Rust itself was a change to the README to add a line to run when installing some dependencies via pacman.

Anyways, what got me into the language in the first place was just its promise as a legitimate replacement for C++, keeping the good stuff like manual memory management, but putting it in a nice modern package.

**Tomasz:** I started playing around with Rust in 2013, before crates.io was a thing, back when Box was ~, and @ was a garbage-collected pointer. I got into Rust following a breakup of a long term relationship with D. At the time I wrote a toy Rusty rendering engine in which I prototyped a few novel algorithms, like stochastic screen-space reflections, and probe-based global illumination. I made a few attempts at converting coworkers too, but did not succeed. The language was a bit rough around the corners back then, and I also needed some stability, so I ended up using C++ for a bit instead. I came back around 2017, and have been happily coding in Rust since.

#### How has using Rust changed your development workflow?

**J:** It just made me enjoy programming again, which is a great quality of life improvement when you do that for your job every day. Sure, there are new problems that Rust gives that aren't present in typical C++ scenarios, particularly around dependency management, but the difference is that the community and ecosystem around Rust is much, much more open compared to C++, and solving problems, especially in the core language and tooling, tends to help everyone who uses Rust. So just being able to participate in a wider community is easily the biggest difference to my workflow.

**T:** It just makes me happier. The borrow checker has greatly improved the quality of my sleep, and made collaboration a breeze. Teamwork is much better when you can trust other people not to introduce subtle threading and ownership issues. In my personal development, I don’t need need to reinvent the wheel nearly as much as when using C++ or D.

The tooling is amazing, and mostly just works. Back in C++ I found myself always struggling with its limited expressive power, and lack of every-day features like modules and reflection. When using D, I felt alone despite actively engaging with the community, and ended up reinventing the wheel all the time. Rust fixes all of that and even takes over many cases where I previously would have used Python.

#### What tools do you use on a daily basis?

**J:** I use the typical tools of cargo/[rustfmt](https://github.com/rust-lang/rustfmt)/[clippy](https://github.com/rust-lang/rust-clippy) on a daily basis, all on Fedora, which is another way that Rust improves my daily workflows and enables me to be more productive.

**T:** [Visual Studio Code](https://code.visualstudio.com/) with [Rust Analyzer](https://rust-analyzer.github.io/) _(editor note: Embark sponsors Rust Analyzer because we think it’s awesome!)_ for my key mashing. [Clippy](https://github.com/rust-lang/rust-clippy) and [rustfmt](https://github.com/rust-lang/rustfmt) to keep it sane.

#### Tell me about an open source crate you really like.

**J:** I really love [clap](https://clap.rs/) + [structopt](https://github.com/TeXitoi/structopt). The ability to write nice declarative CLIs is still pretty magical to me, it’s always the first crate I add a dependency on when making a new command-line tool.

**T:** I love [lalrpop](https://github.com/lalrpop/lalrpop)! It’s a parser generator framework that’s a pleasure to use. I wrote a few dozen parsers in my life, and quite often ended up on the fence between rolling one from scratch and using a generator. The latter would typically be quicker to start with, but frustrating whenever trying to do something not covered by examples. lalrpop makes for very succinct grammars, trivial translation to abstract syntax trees. It’s fast enough, and it’s extremely helpful if you have a mistake somewhere in your grammar definition.

#### Where do you want to see the Rust project go in 2020 and beyond?

**J:** Technically speaking, I would love to see more crates hit 1.0, and maybe a few things in cargo like dependency profiles and such. Non-technically, I would just love to see the Rust ecosystem have a more clear direction to sustainability so that this great language and community can keep growing for years to come.

**T:** There are a few technical features I wish for, such as stable specialization, generic associated types, and faster compile times. Build speed can be improved by using artisanal hand-crafted RUSTFLAGS in conjunction with LLD, but after having used D, I always want more. The other stuff is mostly quality-of-life improvements for reducing boilerplate.

I'd love to see the community grow, and expand into more professional use, especially around game development. Rust's cross-platform open-source ecosystem could be a game-changer for smaller studios that don't have the resources to invent bespoke tech all the time.

![](https://cdn-images-1.medium.com/max/1024/1*wL9FvRCwlO8X0ysJ8348kw.png)

We love the Rust community and are always looking for new ways to contribute and help build a thriving open-source ecosystem for game development in Rust.

You can get more details about our plans for Rust and game dev at [embark.rs!](https://embark.rs)

If you are interested in collaborating or working together, check out our projects on [embark.dev](http://embark.dev) or reach out to us at [opensource@embark-studios.com](mailto:opensource@embark-studios.com).

#### Connect with us:

[→ Embark open source work at embark.dev](https://embark.dev)

[→ Rust ecosystem issue tracking at embark.rs](https://embark.rs)

[→ Follow our developer newsletter](https://bit.ly/embarkdev)

[→ EmbarkStudios on Twitter](https://twitter.com/embarkstudios)

* * *