File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ pub use crate::{
29
29
extend_with:: ExtendWith ,
30
30
filter_anti:: FilterAnti ,
31
31
filter_with:: FilterWith ,
32
- filters:: { PrefixFilter , ValueFilter } ,
32
+ filters:: { passthrough , PrefixFilter , ValueFilter } ,
33
33
Leaper , Leapers , RelationLeaper ,
34
34
} ,
35
35
variable:: Variable ,
Original file line number Diff line number Diff line change @@ -190,6 +190,25 @@ pub(crate) mod filters {
190
190
}
191
191
}
192
192
193
+ /// Returns a leaper that proposes a single copy of each tuple from the main input.
194
+ ///
195
+ /// Use this when you don't need any "extend" leapers in a join, only "filter"s. For example,
196
+ /// in the following datalog rule, all terms in the second and third predicate are bound in the
197
+ /// first one (the "main input" to our leapjoin).
198
+ ///
199
+ /// ```prolog
200
+ /// error(loan, point) :-
201
+ /// origin_contains_loan_at(origin, loan, point), % main input
202
+ /// origin_live_at(origin, point),
203
+ /// loan_invalidated_at(loan, point).
204
+ /// ```
205
+ ///
206
+ /// Without a passthrough leaper, neither the filter for `origin_live_at` nor the one for
207
+ /// `loan_invalidated_at` would propose any tuples, and the leapjoin would panic at runtime.
208
+ pub fn passthrough < Tuple > ( ) -> PrefixFilter < Tuple , fn ( & Tuple ) -> bool > {
209
+ PrefixFilter :: from ( |_| true )
210
+ }
211
+
193
212
/// A treefrog leaper based on a predicate of prefix and value.
194
213
/// Use like `ValueFilter::from(|tuple, value| ...)`. The closure
195
214
/// should return true if `value` ought to be retained. The
You can’t perform that action at this time.
0 commit comments