You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with offset:@escaping([Output])->Instruction<O>)->Pager<O,Self>.Iteration{
46
-
iterate{
47
-
switchoffset($0){
48
-
case.stop:
49
-
return.stop
50
-
case.load(let next):
51
-
returnexception(next)?.stop :.load(next)
52
-
}
46
+
iterate{ value ->Instruction<O>in
47
+
letinstruction=offset(value)
48
+
guard case .load(let next)= instruction else{return instruction }
49
+
returnexception(next)?.stop :.load(next)
53
50
}
54
51
}
55
52
@@ -78,13 +75,10 @@ public extension Publisher {
78
75
/// - offet: A valid offset generator.
79
76
/// - returns: A valid `Pager.Iteration`.
80
77
func iterateFirst<O>(stoppingAt exception:@escaping(O)->Bool, with offset:@escaping(Output?)->Instruction<O>)->Pager<O,Publishers.Output<Self>>.Iteration{
81
-
iterateFirst{
82
-
switchoffset($0){
83
-
case.stop:
84
-
return.stop
85
-
case.load(let next):
86
-
returnexception(next)?.stop :.load(next)
87
-
}
78
+
iterateFirst{ value ->Instruction<O>in
79
+
letinstruction=offset(value)
80
+
guard case .load(let next)= instruction else{return instruction }
81
+
returnexception(next)?.stop :.load(next)
88
82
}
89
83
}
90
84
@@ -113,13 +107,10 @@ public extension Publisher {
113
107
/// - offet: A valid offset generator.
114
108
/// - returns: A valid `Pager.Iteration`.
115
109
func iterateLast<O>(stoppingAt exception:@escaping(O)->Bool, with offset:@escaping(Output?)->Instruction<O>)->Pager<O,Publishers.Last<Self>>.Iteration{
116
-
iterateLast{
117
-
switchoffset($0){
118
-
case.stop:
119
-
return.stop
120
-
case.load(let next):
121
-
returnexception(next)?.stop :.load(next)
122
-
}
110
+
iterateLast{ value ->Instruction<O>in
111
+
letinstruction=offset(value)
112
+
guard case .load(let next)= instruction else{return instruction }
113
+
returnexception(next)?.stop :.load(next)
123
114
}
124
115
}
125
116
@@ -140,6 +131,112 @@ public extension Publisher {
/// Create the iteration, after only one output, making sure we don't get stuck inside an infinite loop.
186
+
///
187
+
/// - parameters:
188
+
/// - exception: A valid `Offset` handler. Return `true` to stop the stream.
189
+
/// - offet: A valid offset generator.
190
+
/// - returns: A valid `Pager.Iteration`.
191
+
func iterateFirst<W>(stoppingAt exception:@escaping(W?)->Bool, with offset:@escaping(Output?)->Instruction<W>)->Pager<W?,Publishers.Output<Self>>.Iteration{
192
+
iterateFirst{ value ->Instruction<W>in
193
+
letinstruction=offset(value)
194
+
guard case .load(let next)= instruction else{return instruction }
195
+
returnexception(next)?.stop :.load(next)
196
+
}
197
+
}
198
+
199
+
/// Create the iteration, after only one output, making sure we don't get stuck inside an infinite loop.
200
+
///
201
+
/// - parameters:
202
+
/// - exception: A valid `Offset`.
203
+
/// - offet: A valid offset generator.
204
+
/// - returns: A valid `Pager.Iteration`.
205
+
func iterateFirst<W>(stoppingAt exception:W?, with offset:@escaping(Output?)->Instruction<W>)->Pager<W?,Publishers.Output<Self>>.Iterationwhere W:Equatable{
/// Create the iteration, on the last output alone., making sure we don't get stuck inside an infinite loop.
218
+
///
219
+
/// - parameters:
220
+
/// - exception: A valid `Offset` handler. Return `true` to stop the stream.
221
+
/// - offet: A valid offset generator.
222
+
/// - returns: A valid `Pager.Iteration`.
223
+
func iterateLast<W>(stoppingAt exception:@escaping(W?)->Bool, with offset:@escaping(Output?)->Instruction<W>)->Pager<W?,Publishers.Last<Self>>.Iteration{
224
+
iterateLast{ value ->Instruction<W>in
225
+
letinstruction=offset(value)
226
+
guard case .load(let next)= instruction else{return instruction }
227
+
returnexception(next)?.stop :.load(next)
228
+
}
229
+
}
230
+
231
+
/// Create the iteration, on the last output alone., making sure we don't get stuck inside an infinite loop.
232
+
///
233
+
/// - parameters:
234
+
/// - exception: A valid `Offset`.
235
+
/// - offet: A valid offset generator.
236
+
/// - returns: A valid `Pager.Iteration`.
237
+
func iterateLast<W>(stoppingAt exception:W?, with offset:@escaping(Output?)->Instruction<W>)->Pager<W?,Publishers.Last<Self>>.Iterationwhere W:Equatable{
0 commit comments