@@ -55,71 +55,6 @@ extension ConfigUpdatesAsyncSequence: AsyncSequence {
55
55
}
56
56
}
57
57
58
- /// A concrete async sequence that wraps an existential async sequence.
59
- ///
60
- /// This type provides a concrete implementation of `AsyncSequence` that wraps
61
- /// an existential `any AsyncSequence`. It serves as a workaround for limitations
62
- /// in Swift's type system where certain operations like `map` and other sequence
63
- /// transformations don't work directly with existential async sequences.
64
- ///
65
- /// ## Purpose
66
- ///
67
- /// The Swift standard library's async sequence operations require concrete types
68
- /// to function properly. When working with `any AsyncSequence`, these operations
69
- /// are not available. This wrapper provides a concrete type that enables the use
70
- /// of standard async sequence operations.
71
- ///
72
- /// ## Usage
73
- ///
74
- /// ```swift
75
- /// let existentialSequence: any AsyncSequence<Int, Never> = someAsyncSequence
76
- /// let concreteSequence = ConcreteAsyncSequence(existentialSequence)
77
- ///
78
- /// // Now you can use standard async sequence operations
79
- /// let mappedSequence = concreteSequence.map { $0 * 2 }
80
- /// ```
81
- package struct ConcreteAsyncSequence < Element: Sendable , Failure: Error > {
82
-
83
- /// The upstream async sequence that this concrete sequence wraps.
84
- ///
85
- /// This property holds the async sequence that provides the actual elements.
86
- /// All operations on this concrete sequence are delegated to this upstream sequence.
87
- var upstream : any AsyncSequence < Element , Failure >
88
-
89
- /// Creates a new concrete async sequence wrapping the provided existential sequence.
90
- ///
91
- /// - Parameter upstream: The async sequence to wrap.
92
- package init ( _ upstream: any AsyncSequence < Element , Failure > ) {
93
- self . upstream = upstream
94
- }
95
- }
96
-
97
- extension ConcreteAsyncSequence : AsyncSequence {
98
-
99
- /// An async iterator that wraps an existential async iterator.
100
- ///
101
- /// This iterator provides the concrete implementation for iterating over
102
- /// the wrapped existential async sequence. It delegates all operations
103
- /// to the upstream iterator while maintaining type safety.
104
- package struct Iterator : AsyncIteratorProtocol {
105
-
106
- /// The upstream async iterator that provides the actual iteration logic.
107
- var upstream : any AsyncIteratorProtocol < Element , Failure >
108
-
109
- // swift-format-ignore: AllPublicDeclarationsHaveDocumentation
110
- package mutating func next(
111
- isolation actor : isolated ( any Actor ) ?
112
- ) async throws ( Failure) -> Element ? {
113
- try await upstream. next ( isolation: actor )
114
- }
115
- }
116
-
117
- // swift-format-ignore: AllPublicDeclarationsHaveDocumentation
118
- package func makeAsyncIterator( ) -> Iterator {
119
- Iterator ( upstream: upstream. makeAsyncIterator ( ) )
120
- }
121
- }
122
-
123
58
// MARK: - AsyncSequence extensions
124
59
125
60
extension AsyncSequence where Failure == Never {
0 commit comments