Crate rustler[−][src]
Expand description
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.
This crate provides the entire runtime library for rustler. Code generators are located in the rustler_codegen library.
Getting Started
There is a :rustler package on hex.pm that provides
functionality which makes working with Rustler easier, including project generators, an
automatic NIF compiler for Mix, and utilities for loading the compiled NIF.
For more information about this, see the documentation for rustler_mix.
Re-exports
pub extern crate lazy_static; | |
pub use crate::types::Atom; | |
pub use crate::types::Binary; | |
pub use crate::types::Decoder; | |
pub use crate::types::Encoder; | |
pub use crate::types::OwnedBinary; | |
pub use crate::resource::ResourceArc; | |
pub use crate::schedule::SchedulerFlags; | |
pub use crate::env::Env; | |
pub use crate::env::OwnedEnv; | |
pub use crate::thread::spawn; | |
pub use crate::thread::JobSpawner; | |
pub use crate::thread::ThreadSpawner; | |
pub use crate::error::Error; | |
pub use crate::return::Return; |
Modules
| env | |
| error | |
| export | |
| resource | Support for storing Rust data in Erlang terms. |
| return | |
| schedule | |
| thread | |
| types |
Macros
| atoms | Macro for defining Rust functions that return Erlang atoms.
To use this macro, you must also import the |
| init | Implementation of a Native Implementated Function (NIF) macro that lets the user annotate a function that will be wrapped in higer-level NIF implementation. |
| resource | |
| resource_struct_init | Deprecated |
| rustler_atoms | Deprecated |
| rustler_export_nifs | Deprecated Exports a given list of functions to a Erlang module. |
Structs
| ListIterator | Enables iteration over the items in the list. |
| LocalPid | |
| MapIterator | |
| Term | Term is used to represent all erlang terms. Terms are always lifetime limited by a Env. |
Enums
| TermType |
Traits
| Nif |
Type Definitions
| NifResult |
Attribute Macros
| nif | Implementation of a Native Implementated Function (NIF) macro that lets the user annotate a function that will be wrapped in higer-level NIF implementation. |
Derive Macros
| NifMap | Implementation of a macro that lets the user annotate a struct with |
| NifRecord | Implementation of the |
| NifStruct | Implementation of the |
| NifTuple | Implementation of a macro that lets the user annotate a struct with |
| NifUnitEnum | Implementation of the |
| NifUntaggedEnum | Implementation of the |