Skip to content

Commit 8a2b998

Browse files
committed
make it possible to join over a relation too
1 parent 170489a commit 8a2b998

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/join.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub(crate) fn gallop<T>(mut slice: &[T], mut cmp: impl FnMut(&T) -> bool) -> &[T
116116
slice
117117
}
118118

119-
pub(crate) trait JoinInput<'me, Tuple: Ord>: Copy {
119+
pub trait JoinInput<'me, Tuple: Ord>: Copy {
120120
type RecentTuples: Deref<Target = [Tuple]>;
121121
type StableTuples: Deref<Target = [Relation<Tuple>]>;
122122

@@ -136,3 +136,16 @@ impl<'me, Tuple: Ord> JoinInput<'me, Tuple> for &'me Variable<Tuple> {
136136
Ref::map(self.stable.borrow(), |v| &v[..])
137137
}
138138
}
139+
140+
impl<'me, Tuple: Ord> JoinInput<'me, Tuple> for &'me Relation<Tuple> {
141+
type RecentTuples = &'me [Tuple];
142+
type StableTuples = &'me [Relation<Tuple>];
143+
144+
fn recent(self) -> Self::RecentTuples {
145+
&[]
146+
}
147+
148+
fn stable(self) -> Self::StableTuples {
149+
std::slice::from_ref(self)
150+
}
151+
}

0 commit comments

Comments
 (0)