File tree Expand file tree Collapse file tree 5 files changed +348
-188
lines changed
Sources/AsyncAlgorithms/Merge
Tests/AsyncAlgorithmsTests Expand file tree Collapse file tree 5 files changed +348
-188
lines changed Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ extension AsyncMerge2Sequence: AsyncSequence {
79
79
}
80
80
}
81
81
82
- public extension AsyncMerge2Sequence {
83
- struct AsyncIterator : AsyncIteratorProtocol {
82
+ extension AsyncMerge2Sequence {
83
+ public struct AsyncIterator : AsyncIteratorProtocol {
84
84
/// This class is needed to hook the deinit to observe once all references to the ``AsyncIterator`` are dropped.
85
85
///
86
86
/// If we get move-only types we should be able to drop this class and use the `deinit` of the ``AsyncIterator`` struct itself.
Original file line number Diff line number Diff line change @@ -92,12 +92,12 @@ struct MergeStateMachine<
92
92
// An iterator was created and we deinited the sequence.
93
93
// This is an expected pattern and we just continue on normal.
94
94
// Importantly since we are a unicast sequence no more iterators can be created
95
- break
95
+ return
96
96
97
97
case . finished:
98
98
// We are already finished so there is nothing left to clean up.
99
99
// This is just the references dropping afterwards.
100
- break
100
+ return
101
101
102
102
case . modifying:
103
103
preconditionFailure ( " Invalid state " )
@@ -160,7 +160,7 @@ struct MergeStateMachine<
160
160
case . upstreamFailure:
161
161
// The iterator was dropped which signals that the consumer is finished.
162
162
// We can transition to finished now. The cleanup already happened when we
163
- // transitioned to `upstreamThrew `.
163
+ // transitioned to `upstreamFailure `.
164
164
state = . finished
165
165
166
166
return . none
You can’t perform that action at this time.
0 commit comments