This page aims to give a comprehensive overview of the available language interop options for the Rust programming language.


We want to highlight libraries that enable using:
- Rust as a guest language (e.g. "Rust in Python" for speeding up Python libraries)
- Using other guest languages from Rust(e.g. "Python in Rust" for taking advantage of rich foreign ecosystems)



This page aims to highlight deep integrations between Rust and a specific foreign language. Luckily, even if those do not exist, we can fall back to FFI or other polyglot technologies (e.g. WASM).

Some links for more generalized foreign language integrations:
-Rustonomicon chapter about FFI
-Examples for using FFI with many languages
-bindgen crate to automatically generate Rust FFI bindings to C (and some C++) libraries.
-Rust and Webassembly book

C

C in Rust

cc-rs

A library to compile C/C++/assembly into a Rust library/application.

Rust in C

cbindgen

cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.

C++

C++ in Rust

autocxx

This project is a tool for calling C++ from Rust in a heavily automated, but safe, fashion. Think of autocxx as glue which plugs bindgen into cxx.

CXX

This library provides a safe mechanism for calling C++ code from Rust and Rust code from C++

rust-cpp

rust-cpp is a build tool & macro which enables you to write C++ code inline in your rust code.

Rust in C++

cbindgen

cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.

CXX

This library provides a safe mechanism for calling C++ code from Rust and Rust code from C++

rust_swig

Tool for connecting programs or libraries written in Rust with other languages. Currently implemented support for C++ and Java, but you can write support for any language of your choice.

Dart

Rust in Dart

DUSTR

Dart - rust - Flutter compatibility

Elixir

Rust in Elixir

Rustler

Rustler is a library for writing Erlang NIFs in safe Rust code. The library provides functionality for both Erlang and Elixir.

Erlang

Rust in Erlang

Rustler

Rustler is a library for writing Erlang NIFs in safe Rust code. The library provides functionality for both Erlang and Elixir.

Java

Java in Rust

j4rs

j4rs stands for 'Java for Rust' and allows effortless calls to Java code from Rust and vice-versa.

Rust in Java

j4rs

j4rs stands for 'Java for Rust' and allows effortless calls to Java code from Rust and vice-versa.

robusta

This library provides a procedural macro to make easier to write JNI-compatible code in Rust. It can perform automatic conversion of Rust-y input and output types

rust_swig

Tool for connecting programs or libraries written in Rust with other languages. Currently implemented support for C++ and Java, but you can write support for any language of your choice.

JavaScript

Rust in JavaScript

napi-rs

A minimal library for building compiled Node add-ons in Rust, wrapping Node.js N-API.

neon-bindings

Rust bindings for writing safe and fast native Node.js modules. Wraps V8 API at the moment, Node.js N-API support is work in progress.

node-bindgen

Easy way to write Node.js module using Rust, wrapping Node.js N-API.

Julia

Julia in Rust

jlrs

The main goal behind jlrs is to provide a simple and safe interface to the Julia C API.

Lua

Lua in Rust

hlua

This library is a high-level binding for Lua 5.2.

rlua

This library is a high level interface between Rust and Lua. Its goal is to be an easy to use, practical, flexible, and safe API between Rust and Lua.

Python

Python in Rust

rust-cpython

Rust bindings for the python interpreter.

inline-pythonRequires nightly

Inline Python code directly in your Rust code.

PyO3

Rust bindings for Python. This includes running and interacting with Python code from a Rust binary, as well as writing native Python modules.

Rust in Python

rust-cpython

Rust bindings for the python interpreter.

milksnake

Milksnake is an extension for setuptools that allows you to distribute dynamic linked libraries in Python wheels in the most portable way imaginable.

PyO3

Rust bindings for Python. This includes running and interacting with Python code from a Rust binary, as well as writing native Python modules.

R

Rust in R

extendr

A safe and user friendly R extension interface using Rust

r-rust Hello Rust template

Template R package with rust bindings

Ruby

Ruby in Rust

Rutie

Integrate Ruby with your Rust application. Or integrate Rust with your Ruby application. Continuation of ruru and ruby-sys.

Rust in Ruby

Helix

Helix allows you to write Ruby classes in Rust without having to write the glue code yourself.

Ruru

Native Ruby extensions in Rust

Rutie

Integrate Ruby with your Rust application. Or integrate Rust with your Ruby application. Continuation of ruru and ruby-sys.