Elixir and Rust are two complementary languages, each excelling in specific areas. This tutorial will explore how to effectively combine their strengths by examining where Rust is a good fit within an Elixir application. We’ll introduce rustler, a tool that allows developers to write Native Interface Functions (NIFs) in Rust and load them seamlessly on the Elixir side. Additionally, we’ll delve into orchestrating Rust NIFs using Elixir’s and BEAM’s powerful primitives, as well as leveraging Rust’s fearless concurrency for multithreading and integrating it with Elixir’s robust concurrency model.
TUTORIAL OBJECTIVES:
- To understand when to use Elixir, when to use Rust, and when to use them together.
- Understand the foundations of Rust.
- Learn how to orchestrate Rust NIFs using Elixir’s concurrency model in the BEAM.
PREREQUISITES:
- Solid knowledge of Elixir.
- Curious about Rust, but no previous knowledge is required.
TARGET AUDIENCE:
- Elixir developers who are looking for solutions to run or accelerate CPU-heavy routines within their BEAM-hosted applications.
- Elixir developers who want to leverage libraries from the Rust ecosystem within their Elixir applications.