File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,16 @@ impl<Tuple: Ord> Relation<Tuple> {
100
100
Relation { elements }
101
101
}
102
102
103
+ /// Creates a `Relation` from the elements of the `iterator`.
104
+ ///
105
+ /// Same as the `from_iter` method from `std::iter::FromIterator` trait.
106
+ pub fn from_iter < I > ( iterator : I ) -> Self
107
+ where
108
+ I : IntoIterator < Item = Tuple >
109
+ {
110
+ iterator. into_iter ( ) . collect ( )
111
+ }
112
+
103
113
/// Creates a `Relation` using the `leapjoin` logic;
104
114
/// see [`Variable::leapjoin`]
105
115
pub fn from_leapjoin < ' a , SourceTuple : Ord , Val : Ord + ' a > (
@@ -138,7 +148,7 @@ impl<Tuple: Ord> Relation<Tuple> {
138
148
/// Construct a new relation by mapping another one. Equivalent to
139
149
/// creating an iterator but perhaps more convenient. Analogous to
140
150
/// `Variable::from_map`.
141
- pub fn from_map < T2 : Ord > ( & self , input : & Relation < T2 > , logic : impl FnMut ( & T2 ) -> Tuple ) -> Self {
151
+ pub fn from_map < T2 : Ord > ( input : & Relation < T2 > , logic : impl FnMut ( & T2 ) -> Tuple ) -> Self {
142
152
input. iter ( ) . map ( logic) . collect ( )
143
153
}
144
154
You can’t perform that action at this time.
0 commit comments