Merge Merge/MergeBy/MergeJoinBy implementations#711
Closed
Philippe-Cholet wants to merge 9 commits into
Closed
Conversation
To get rid of `const SAME: bool`, I wrap the function `F` in `MergeFuncLR` and `MergeFuncT`. Those `MergeFuncLR/T` have a parameter `T` (phantom field) to not have conflicting implementations of `MergePredicate<L, R>`. In `merge_join_by` definition, in order for the compiler to keep guessing left/right types, I kept `F: FnMut(&Self::Item, &J::Item) -> T`. But to not add `F: MergePredicate<Self::Item, J::Item>` that felt duplicate, I removed `T: OrderingOrBool...`, the user might lose `OrderingOrBool` information.
And I simplify `MergeFuncLR` and `MergeFuncT` to "tuple structs".
Basically because `PutBack<Fuse<I>>` is fused no matter if `I` is or not. Same for `J`.
Member
|
Hi @Philippe-Cholet, thanks for this. I try to pick this up, but I am very unsure that |
Member
Author
|
@phimuemue A bit disappointed, I started again and to my own surprise I quickly found a way (fresh eyes I guess). So 0a3f122 |
Member
Author
|
I'm closing this. This is the result of some useful experiments but became too messy to be properly reviewed and it deserves a cleaner PR I'm currently working on. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
MergeandMergeByare moved from "adaptors" to "merge_join" modules.Then
Merge,MergeByandMergeJoinByare now instances of a new (common and private) struct:InternalMergeJoinBy.Internally, instead of
OrderingOrBoolandFnMut(&L, &R) -> Out, we useMergePredicate<L, R, Out=...>(OutbeingOrderingorbool).And with
MergeFuncTandMergeFuncLRalso kept private, the functions return those types:The only changes for an external user:
MergeJoinBysadly requires now a fourth type (it was that or share the internalMergeFuncLRpublicly).MergeJoinBynow implementsFusedIteratortoo.Closes #701
PS: In
fn merge_join_by, the constraintT: OrderingOrBool<I::Item, J::Item>,has been removed. Even if the documentation is clear, we could add it back in some way if you want.