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

Use map_from_arrays() for map construction in rustler_codegen #451

Closed
evnu opened this issue May 3, 2022 · 2 comments · Fixed by #453
Closed

Use map_from_arrays() for map construction in rustler_codegen #451

evnu opened this issue May 3, 2022 · 2 comments · Fixed by #453

Comments

@evnu
Copy link
Member

evnu commented May 3, 2022

As noted in #440, we should try to use map_from_arrays() when constructing maps in rustler_codegen. As pointed out by @SeokminHong, changing the signature of map_from_arrays() to use impl Encoder instead of Term<'a> could simplify that:

    pub fn map_from_arrays(
        env: Env<'a>,
        keys: &[impl Encoder],
        values: &[impl Encoder],
    ) -> NifResult<Term<'a>> {
@hansihe
Copy link
Member

hansihe commented May 4, 2022

As long as we use impl Encoder + 'a I believe this should be a non-breaking change?

@philss
Copy link
Member

philss commented May 5, 2022

Can we use map_from_pairs/2 instead? Anyway, the same change may apply to that function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants