From a74da09741d48d7eb8b245e96e219a855b7fb3bc Mon Sep 17 00:00:00 2001 From: Philippe-Cholet Date: Thu, 15 Jun 2023 10:31:26 +0200 Subject: [PATCH] Use L/R for Left/Right types Because I/J stand for iterators. --- src/merge_join.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/merge_join.rs b/src/merge_join.rs index 4c7e35cdc..84f7d0333 100644 --- a/src/merge_join.rs +++ b/src/merge_join.rs @@ -37,26 +37,26 @@ pub struct MergeJoinBy { cmp_fn: F, } -pub trait OrderingOrBool { +pub trait OrderingOrBool { type MergeResult; - fn left(left: I) -> Self::MergeResult; - fn right(right: J) -> Self::MergeResult; + fn left(left: L) -> Self::MergeResult; + fn right(right: R) -> Self::MergeResult; // "merge" never returns (Some(...), Some(...), ...) so Option> // is appealing but it is always followed by two put_backs, so we think the compiler is // smart enough to optimize it. Or we could move put_backs into "merge". - fn merge(self, left: I, right: J) -> (Option, Option, Self::MergeResult); + fn merge(self, left: L, right: R) -> (Option, Option, Self::MergeResult); fn size_hint(left: SizeHint, right: SizeHint) -> SizeHint; } -impl OrderingOrBool for Ordering { - type MergeResult = EitherOrBoth; - fn left(left: I) -> Self::MergeResult { +impl OrderingOrBool for Ordering { + type MergeResult = EitherOrBoth; + fn left(left: L) -> Self::MergeResult { EitherOrBoth::Left(left) } - fn right(right: J) -> Self::MergeResult { + fn right(right: R) -> Self::MergeResult { EitherOrBoth::Right(right) } - fn merge(self, left: I, right: J) -> (Option, Option, Self::MergeResult) { + fn merge(self, left: L, right: R) -> (Option, Option, Self::MergeResult) { match self { Ordering::Equal => (None, None, EitherOrBoth::Both(left, right)), Ordering::Less => (None, Some(right), EitherOrBoth::Left(left)), @@ -75,15 +75,15 @@ impl OrderingOrBool for Ordering { } } -impl OrderingOrBool for bool { - type MergeResult = Either; - fn left(left: I) -> Self::MergeResult { +impl OrderingOrBool for bool { + type MergeResult = Either; + fn left(left: L) -> Self::MergeResult { Either::Left(left) } - fn right(right: J) -> Self::MergeResult { + fn right(right: R) -> Self::MergeResult { Either::Right(right) } - fn merge(self, left: I, right: J) -> (Option, Option, Self::MergeResult) { + fn merge(self, left: L, right: R) -> (Option, Option, Self::MergeResult) { if self { (None, Some(right), Either::Left(left)) } else {