rusterlium / rustler

Safe Rust bridge for creating Erlang NIF functions
https://docs.rs/crate/rustler
Apache License 2.0
4.24k stars 222 forks source link

Add support for generic types #574

Closed turion closed 7 months ago

turion commented 8 months ago

Closes #424. Allows generic type parameters in the derive macros:

    #[derive(NifStruct)]
    #[module = "GenericStruct"]
    pub struct GenericStruct<T> {
        t: T
    }
turion commented 8 months ago

CC @evnu this obsoletes #425

turion commented 8 months ago

Note that functions to which the #[rustler::nif] macro is applied must still be monomorphic, otherwise rustler wouldn't know into which type to decode.

turion commented 8 months ago

I'm not sure where I should add documentation.