Crate rustler_codegen

Source

Macros§

init
Initialise the Native Implemented Function (NIF) environment and register NIF functions in an Elixir module.

Attribute Macros§

nif
Wrap a function in a Native Implemented Function (NIF) implementation, so that it can be called from Elixir, with all encoding and decoding steps done automatically.
resource_impl
Helper attribute for Resource implementations

Derive Macros§

NifException
Derives implementations for the Encoder and Decoder traits which convert between an Elixir exception and a Rust struct.
NifMap
Derives implementations for the Encoder and Decoder traits which convert between Rust struct and an Elixir map.
NifRecord
Derives implementations for the Encoder and Decoder traits which convert between a Rust struct and an Elixir record.
NifStruct
Derives implementations for the Encoder and Decoder traits which convert between an Elixir struct and a Rust struct.
NifTaggedEnum
Implementation of the NifTaggedEnum macro that lets the user annotate an enum that will generate elixir values when encoded. This can be used for any rust enums and will generate three types of values based on the kind of the enum. For example from the test code:
NifTuple
Derives implementations for the Encoder and Decoder traits which convert between a Rust struct and an Elixir tuple.
NifUnitEnum
Derives implementations for the Encoder and Decoder traits which convert between an enum and a union of elixir atoms.
NifUntaggedEnum
Derives implementations for the Encoder and Decoder traits which convert between a Rust enum and a union of Elixir types.