-
Notifications
You must be signed in to change notification settings - Fork 226
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
Fix NifTaggedEnum derived Encoder impl for named-field variants #547
Fix NifTaggedEnum derived Encoder impl for named-field variants #547
Conversation
Hmm, do you have an explanation what's wrong with the previous code? |
I don't think you can make a slice for the I agree on the efficiency part - I'll see if I can figure out the alternate option of |
This StackOverflow post has some better explanations of that type of error. The solution they got was basically |
I made some local changes in order to get the NifStruct benchmark to run using different near-copies of
The struct being encoded is just 26 @filmor Do you have a preference? |
I'd prefer Thank you very much for the thorough testing and evaluation! |
…ders - Removed map_from_iterables and supporting trait, from earlier in the PR - Updated tests for Map, Struct, and Exception to have heterogenous types
Use map_from_term_arrays in Nif{Map,Struct,Exception,TaggedEnum} encoders
Hi 👋,
On rustler 0.28.0, I get an error in the generated code from enums like this:
The slice was being passed to
map_from_arrays
. I looked at NifMap's equivalentgen_named_encoder
and copied themap_put
strategy, which worked.If performance is a concern, I think a set of
map_from(env, k1, v1, ...)
functions for small map sizes could accomplish the same thing but still useenif_make_map_from_arrays
.