Skip to content

Commit dfba548

Browse files
authored
Merge pull request #18 from nikomatsakis/leapjoin_docs
add some docs to leapjoin
2 parents 1cc53d1 + 49f7d5f commit dfba548

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,27 @@ impl<Tuple: Ord> Variable<Tuple> {
300300
/// The main limitation is that the things being combined must
301301
/// consist of one dynamic variable (`source`) and then several
302302
/// fixed relations (`leapers`).
303+
///
304+
/// The idea is as follows:
305+
///
306+
/// - You will be inserting new tuples that result from joining (and anti-joining)
307+
/// some dynamic variable `source` of source tuples (`SourceTuple`)
308+
/// with some set of values (of type `Val`).
309+
/// - You provide these values by combining `source` with a set of leapers
310+
/// `leapers`, each of which is derived from a fixed relation. You can create
311+
/// a leaper in one of two ways:
312+
/// - Extension: In this case, you have a relation of type `(K, Val)` for some
313+
/// type `K`. You provide a closure that maps from `SourceTuple` to the key
314+
/// `K`. If you use `relation.extend_with`, then any `Val` values the
315+
/// relation provides will be added to the set of values; if you use
316+
/// `extend_anti`, then the `Val` values will be removed.
317+
/// - Filtering: In this case, you have a relation of type `K` for some
318+
/// type `K` and you provide a closure that maps from `SourceTuple` to
319+
/// the key `K`. Filters don't provide values but they remove source
320+
/// tuples.
321+
/// - Finally, you get a callback `logic` that accepts each `(SourceTuple, Val)`
322+
/// that was successfully joined (and not filtered) and which maps to the
323+
/// type of this variable.
303324
pub fn from_leapjoin<'a, SourceTuple: Ord, Val: Ord + 'a>(
304325
&self,
305326
source: &Variable<SourceTuple>,

0 commit comments

Comments
 (0)