File tree Expand file tree Collapse file tree 1 file changed +0
-29
lines changed
Sources/SwiftAPIClient/Extensions Expand file tree Collapse file tree 1 file changed +0
-29
lines changed Original file line number Diff line number Diff line change 1
1
import Foundation
2
2
3
- public struct AsyncSequenceOfElements < S: Sequence > : AsyncSequence {
4
-
5
- public typealias AsyncIterator = AsyncStream < S . Element > . AsyncIterator
6
- public typealias Element = S . Element
7
-
8
- let sequence : S
9
-
10
- public init ( _ sequence: S ) {
11
- self . sequence = sequence
12
- }
13
-
14
- public func makeAsyncIterator( ) -> AsyncStream < S . Element > . AsyncIterator {
15
- AsyncStream { cont in
16
- for element in sequence {
17
- cont. yield ( element)
18
- }
19
- cont. finish ( )
20
- }
21
- . makeAsyncIterator ( )
22
- }
23
- }
24
-
25
- public extension Sequence {
26
-
27
- var async : AsyncSequenceOfElements < Self > {
28
- AsyncSequenceOfElements ( self )
29
- }
30
- }
31
-
32
3
func completionToThrowsAsync< T> (
33
4
_ body: @escaping ( CheckedContinuation < T , Error > , CheckedContinuationCancellationHandler ) -> Void
34
5
) async throws -> T {
You can’t perform that action at this time.
0 commit comments