[][src]Derive Macro rustler_codegen::NifStruct

#[derive(NifStruct)]
{
    // Attributes available to this derive:
    #[module]
}

Implementation of the NifStruct macro that lets the user annotate a struct that will be translated directly from an Elixir struct to a Rust struct. For example, the following struct, annotated as such:

#[derive(Debug, NifStruct)]
#[module = "AddStruct"]
struct AddStruct {
   lhs: i32,
   rhs: i32,
}

This would be translated by Rustler into:

defmodule AddStruct do
    defstruct lhs: 0, rhs: 0
end