@@ -4,8 +4,13 @@ use super::{Relation, Variable};
4
4
use std:: cell:: Ref ;
5
5
use std:: ops:: Deref ;
6
6
7
+ /// Implements `join`. Note that `input1` must be a variable, but
8
+ /// `input2` can be either a variable or a relation. This is necessary
9
+ /// because relations have no "recent" tuples, so the fn would be a
10
+ /// guaranteed no-op if both arguments were relations. See also
11
+ /// `join_into_relation`.
7
12
pub ( crate ) fn join_into < ' me , Key : Ord , Val1 : Ord , Val2 : Ord , Result : Ord > (
8
- input1 : impl JoinInput < ' me , ( Key , Val1 ) > ,
13
+ input1 : & Variable < ( Key , Val1 ) > ,
9
14
input2 : impl JoinInput < ' me , ( Key , Val2 ) > ,
10
15
output : & Variable < Result > ,
11
16
mut logic : impl FnMut ( & Key , & Val1 , & Val2 ) -> Result ,
@@ -34,6 +39,7 @@ pub(crate) fn join_into<'me, Key: Ord, Val1: Ord, Val2: Ord, Result: Ord>(
34
39
output. insert ( Relation :: from_vec ( results) ) ;
35
40
}
36
41
42
+ /// Join, but for two relations.
37
43
pub ( crate ) fn join_into_relation < ' me , Key : Ord , Val1 : Ord , Val2 : Ord , Result : Ord > (
38
44
input1 : & Relation < ( Key , Val1 ) > ,
39
45
input2 : & Relation < ( Key , Val2 ) > ,
0 commit comments