@@ -4,8 +4,13 @@ use super::{Relation, Variable};
44use std:: cell:: Ref ;
55use std:: ops:: Deref ;
66
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`.
712pub ( 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 ) > ,
914 input2 : impl JoinInput < ' me , ( Key , Val2 ) > ,
1015 output : & Variable < Result > ,
1116 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>(
3439 output. insert ( Relation :: from_vec ( results) ) ;
3540}
3641
42+ /// Join, but for two relations.
3743pub ( crate ) fn join_into_relation < ' me , Key : Ord , Val1 : Ord , Val2 : Ord , Result : Ord > (
3844 input1 : & Relation < ( Key , Val1 ) > ,
3945 input2 : & Relation < ( Key , Val2 ) > ,
0 commit comments