The rb_sys gem

Gem
Documentation
Join the discussion

The rb_sys gem makes it easy to build native Ruby extensions in Rust. It interoperates with existing Ruby native
extension toolchains (i.e. rake-compiler) to make testing, building, and cross-compilation of gems easy.

Documentation

For comprehensive documentation, please refer to the Ruby on Rust Book, which
includes:

Basic Usage

# Rakefile
require "rb_sys/extensiontask"

GEMSPEC = Gem::Specification.load("my_gem.gemspec")

RbSys::ExtensionTask.new("my-crate-name", GEMSPEC) do |ext|
  ext.lib_dir = "lib/my_gem"
  ext.cross_compile = true  # For rb-sys-dock cross-compilation
end
# ext/my_gem/extconf.rb
require "mkmf"
require "rb_sys/mkmf"

create_rust_makefile("my_gem")

For full configuration options and more advanced usage, see the
rb_sys Gem Configuration reference.