Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generic types #574

Merged
merged 3 commits into from
Nov 21, 2023
Merged

Add support for generic types #574

merged 3 commits into from
Nov 21, 2023

Conversation

turion
Copy link
Contributor

@turion turion commented Nov 9, 2023

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

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

@turion
Copy link
Contributor Author

turion commented Nov 9, 2023

CC @evnu this obsoletes #425

@turion
Copy link
Contributor Author

turion commented Nov 9, 2023

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
Copy link
Contributor Author

turion commented Nov 9, 2023

I'm not sure where I should add documentation.

@evnu evnu requested a review from a team November 10, 2023 08:46
Copy link
Member

@evnu evnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good work! Some comments from my side.

rustler_codegen/src/encode_decode_templates.rs Outdated Show resolved Hide resolved
rustler_codegen/src/encode_decode_templates.rs Outdated Show resolved Hide resolved
rustler_codegen/src/encode_decode_templates.rs Outdated Show resolved Hide resolved
rustler_codegen/src/encode_decode_templates.rs Outdated Show resolved Hide resolved
rustler_codegen/src/encode_decode_templates.rs Outdated Show resolved Hide resolved
rustler_codegen/src/encode_decode_templates.rs Outdated Show resolved Hide resolved
Copy link
Member

@evnu evnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@evnu evnu merged commit 6249dde into rusterlium:master Nov 21, 2023
34 checks passed
@turion turion deleted the dev_generics2 branch January 12, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NifTuple doesn't work with polymorphic structs
2 participants