Voltar ao ranking

rusterlium/rustler

Rustdocs.rs/crate/rustler

Safe Rust bridge for creating Erlang NIF functions

erlangnifelixirffibindingrust
Crescimento de estrelas
Estrelas
4.8k
Forks
243
Crescimento semanal
Issues
38
2k4k
jan. de 2016jul. de 2019jan. de 2023jul. de 2026
Artefatoscrates.iocargo add rustler
README

Rustler

Documentation | Getting Started | Example

GitHub Actions Workflow Status Hex.pm package version Crates.io package version Last Updated

Rustler is a library for writing Erlang NIFs in safe Rust code. That means there should be no ways to crash the BEAM (Erlang VM). The library provides facilities for generating the boilerplate for interacting with the BEAM, handles encoding and decoding of Erlang terms, and catches rust panics before they unwind into C.

The library provides functionality for both Erlang and Elixir, however Elixir is favored as of now.

Features

Safety
The code you write in a Rust NIF should never be able to crash the BEAM.

Interop
Decoding and encoding rust values into Erlang terms is as easy as a function call.

Type composition
Making a Rust struct encodable and decodable to Erlang or Elixir can be done with a single attribute.

Resource objects
Enables you to safely pass a reference to a Rust struct into Erlang code. The struct will be automatically dropped when it's no longer referenced.

Getting started

The easiest way of getting started is the rustler Elixir library.

  • Add the rustler Elixir library as a dependency of your project.
  • Run mix rustler.new to generate a new NIF in your project. Follow the instructions.
  • If you are already using serde and/or have been using serde_rustler before, please enable the serde feature in your NIF crate's Cargo.toml on the rustler dependency.

What it looks like

This is the code for a minimal NIF that adds two numbers and returns the result.

#[rustler::nif]
fn add(a: i64, b: i64) -> i64 {
    a + b
}

rustler::init!("Elixir.Math");

Minimal Supported Rust Version (MSRV)

Rustler currently has a minimal supported Rust version (MSRV) of 1.91. This is the configured version in .clippy.toml.

Supported OTP and Elixir Versions

Rustler aims to support the newest three major OTP versions as well as newest three minor Elixir versions.

Supported NIF version

The minimal supported NIF version for a library should be defined via Cargo features. The default is currently 2.15 (Erlang/OTP 22). To use features from NIF version 2.16 (Erlang/OTP 24) or 2.17 (Erlang/OTP 26), the respective feature flag has to be enabled on the dependency:

[dependencies]
rustler = { version = "...", features = ["nif_version_2_16"] }

Community

You can find us in the #rustler:matrix.org channel on Matrix or in the #rustler channel in the Elixir lang Slack.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Repositórios relacionados
anoma/anoma

Reference implementation of Anoma

ElixirMIT Licensecryptographyblockchain
anoma.net
33.7k4.1k
asdf-vm/asdf

Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more

GoGo ModulesMIT Licenseversion-managerruby
asdf-vm.com
25.5k929
gleam-lang/gleam

⭐️ A friendly language for building type-safe, scalable systems!

Rustcrates.ioApache License 2.0gleamprogramming-language
gleam.run
21.7k993
emqx/emqx

The most scalable and reliable MQTT broker for AI, IoT, IIoT and connected vehicles

ErlangOthermqttiot
emqx.com
16.5k2.5k
lk-geimfari/awesomo

Cool open source projects. Choose your project and get involved in Open Source development now.

GoGo ModulesCreative Commons Zero v1.0 Universalawesomeocaml
9.9k690
ninenines/cowboy

Small, fast, modern HTTP server for Erlang/OTP.

ErlangISC Licenseerlanghttp
ninenines.eu
7.5k1.2k
apache/couchdb

Seamless multi-primary syncing database with an intuitive HTTP/JSON API, designed for reliability

ErlangApache License 2.0contentnetwork-server
couchdb.apache.org
6.9k1.1k
oldratlee/translations

🐼 Chinese translations for classic software development resources

Othertranslationchinese-translation
github.com/oldratlee/translations
6.9k1.5k
processone/ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)

ErlangOthererlangxmpp
process-one.net/ejabberd/
6.7k1.5k
lunatic-solutions/lunatic

Lunatic is an Erlang-inspired runtime for WebAssembly

Rustcrates.ioApache License 2.0vmwebassembly
lunatic.solutions
4.9k149
ergo-services/ergo

An actor-based Framework with network transparency for creating event-driven architecture in Golang. Inspired by Erlang. Zero dependencies.

GoGo ModulesMIT Licenseerlanggolang
ergo.services
4.6k184
vernemq/vernemq

A distributed MQTT message broker based on Erlang/OTP. Built for high quality & Industrial use cases. The VerneMQ mission is active & the project maintained. Thank you for your support!

ErlangApache License 2.0mqttm2m
vernemq.com
3.6k427