Function rustler_codegen::nif_map[][src]

pub fn nif_map(input: TokenStream) -> TokenStream

Implementation of a macro that lets the user annotate a struct with NifMap so that the struct can be encoded or decoded from an Elixir map. For example, the following struct annotated as such:

#[derive(NifMap)]
struct AddMap {
    lhs: i32,
    rhs: i32,
}

Given the values 33 and 21 for this struct, this would result, when encoded, in an elixir map with two elements like:

%{lhs: 33, rhs: 21}