-
Notifications
You must be signed in to change notification settings - Fork 221
Improved MutableStruct::push
#1223
Improved MutableStruct::push
#1223
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1223 +/- ##
==========================================
+ Coverage 83.22% 83.29% +0.06%
==========================================
Files 358 358
Lines 37281 37619 +338
==========================================
+ Hits 31027 31334 +307
- Misses 6254 6285 +31
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
What do you think about simply removing the check in I am asking because |
Removing the check altogether would be fine for my purposes, but OTOH it's still an important invariant. My inclination is to make it "opt out", i.e. have the most "obvious" option ( Re: |
You are right. What about (note that the integration test is unrelated, it is something upstream) |
Even knowing how On the other hand I've come around somewhat to removing the check altogether. The invariant will be checked when converting to a Yet another option would be |
exactly, that was the reason why I was thinking about keeping Another option I can think about is:
this allows the user to modify the values at will multiple times before the push |
I like removing the check more now, especially since it allows pushing to all the children at once before calling I removed the check altogether and rebased. Should be good to go now, I hope. |
MutableStruct::push
Sorry for the back and forth, I just think it is easier for others to keep the API aligned with Rust (specially functions named Thanks again for the PR and for the discussion 🙇 |
Adds
push_unchecked
toMutableStructArray
.In my tests, this reduced total time to generate a representative StructArray by more than 1/3.