AsyncThrowingStream instead of custom type #204
+80
−90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had a look at your super library and it solved many issues compared to Skie. I had some trouble understanding the asyncSequence as I did not understand why AsyncThrowingStream could not be used directly. So I tried and came up with this solution that at least to me is simpler. Would you consider merging it?
It removes the need for the custom type
NativeFlowAsyncSequence
in favor or theAsyncThrowingStream
so this would be breaking. But it keeps the use in a for try await in ... loop so I did not have to alter the tests for them to work.I added a lock although I think you can debate as the closure of
AsyncThrowingStream
is in Swifts structured concurrency that it is safe to remove it. It does not harm the structured concurrency so I kept it as I do not know if it is needed for the Kotlin part.