File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Channel
2
+
3
+ * Author(s): [ Philippe Hausler] ( https://github.com/phausler )
4
+
5
+ [
6
+ [ Source] ( https://github.com/apple/swift-async-algorithms/blob/main/Sources/AsyncAlgorithms/AsyncChannel.swift ) ,
7
+ [ Source] ( https://github.com/apple/swift-async-algorithms/blob/main/Sources/AsyncAlgorithms/AsyncThrowingChannel.swift ) |
8
+ [ Tests] ( https://github.com/apple/swift-async-algorithms/blob/main/Tests/AsyncAlgorithmsTests/TestChannel.swift )
9
+ ]
10
+
11
+ ## Introduction
12
+
13
+ ## Proposed Solution
14
+
15
+ ``` swift
16
+ public final class AsyncChannel <Element : Sendable >: AsyncSequence , Sendable {
17
+ public struct Iterator : AsyncIteratorProtocol , Sendable {
18
+ public mutating func next () async -> Element ?
19
+ }
20
+
21
+ public init (_ elementType : Element .Type = Element .self )
22
+
23
+ public func send (_ element : Element ) async
24
+ public func finish () async
25
+
26
+ public func makeAsyncIterator () -> Iterator
27
+ }
28
+
29
+ public final class AsyncThrowingChannel <Element : Sendable , Failure : Error >: AsyncSequence , Sendable {
30
+ public struct Iterator : AsyncIteratorProtocol , Sendable {
31
+ public mutating func next () async throws -> Element ?
32
+ }
33
+
34
+ public init (_ elementType : Element .Type = Element .self )
35
+
36
+ public func send (_ element : Element ) async
37
+ public func fail (_ error : Error ) async where Failure == Error
38
+ public func finish () async
39
+
40
+ public func makeAsyncIterator () -> Iterator
41
+ }
42
+ ```
43
+
44
+ ## Detailed Design
45
+
46
+ ## Alternatives Considered
47
+
48
+ It was consider to use the naming heritage of "subject".
49
+
50
+ ## Credits/Inspiration
You can’t perform that action at this time.
0 commit comments