Skip to content

Commit 1fb106f

Browse files
committed
clarify why the current join_into requires at least one variable
1 parent 2b407d7 commit 1fb106f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/join.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ use super::{Relation, Variable};
44
use std::cell::Ref;
55
use 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`.
712
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)>,
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.
3743
pub(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

Comments
 (0)