Break down select output into composable components #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes selecting for
Option<primitive type>
andVec<primitive type>
. It does so by breaking down the code gen for select into three components, one small snippet for how each row is handled depending oncontent
, one small snippet for how the iterator over rows is handled depending oncontainer
, and one shared snippet that puts it all together.The code it generates isn't identical to the original code, but I believe it's logically equivalent. Except for
Vec<OutputType>
instead of first allocating an intermediateVec
withResults
un-flattened.I uncommented some existing tests that checked these for correctness, as well as adding two additional tests for
Option<CustomStruct>
andVec<CustomStruct>
to complete the grid of possibilities (those tests pass before the changes as well).I believe this bumps MSRV to 1.70, and it probably requires a CI change as a result, but before figuring that out I wanted to make sure you were ok with bumping the MSRV. I'm using it for
Option::is_some_and
(that I know about, I'm generally not very careful about not using new features so it wouldn't surprise me to find out I was using something else that bumped MSRV as well). If you're worried about that I can easily rewrite it to use older and only slightly clunkier syntax.Thanks for a cool library :)