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

Change map helper functions' arguments #453

Merged
merged 2 commits into from May 27, 2022

Conversation

SeokminHong
Copy link
Contributor

resolves #451

Change map's helper functions arguments from Term into impl Encoder.

@SeokminHong SeokminHong changed the title Impl encoder Change map helper functions' arguments May 13, 2022
Copy link
Member

@philss philss left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢

keys: &[Term<'a>],
values: &[Term<'a>],
keys: &[impl Encoder],
values: &[impl Encoder],
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be impl Encoder + 'a as @hansihe noted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Encoder::encode encodes a Rust value into a term bounds to env's lifetime. So, the arguments actually don't need the lifetime bound!

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.

This looks nice. I am a little confused if we need to take care of the Env somehow. Users might come up with the idea of passing Terms into the functions and have different environments for the terms.

@evnu evnu merged commit adc0b9d into rusterlium:master May 27, 2022
@SeokminHong SeokminHong deleted the impl-encoder branch May 27, 2022 10:44
@SeokminHong SeokminHong mentioned this pull request Jun 2, 2022
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.

Use map_from_arrays() for map construction in rustler_codegen
4 participants