Skip to content

Commit d0b4a06

Browse files
authored
Rework AsyncStreaming protocols to use generic RangeReplaceableContainer buffers (#417)
Replace `InputSpan`/`OutputSpan` with generic `Buffer` associated types constrained to `RangeReplaceableContainer` across all four streaming protocols. This sidesteps the limitation that `OutputSpan` (and other `~Escapable` types) cannot be used in async contexts today, while still allowing conforming types to choose a buffer representation optimized for their use case (e.g. `UniqueArray` for heap-backed storage, or a future stack-allocated container for embedded). Switch callee-owned protocols from `consuming` to `inout` closure semantics, rename `forEachChunk` to `forEachBuffer`, and move `forEach`/`collect` to future directions in the proposal. Adds test coverage for `AsyncWriter`, `CallerAsyncReader`, and `EitherError`. Updates all documentation to reflect the new API surface.
1 parent 6a92272 commit d0b4a06

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/AsyncStreaming/NNNN-async-streaming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The bite-sized pseudocode:
147147

148148
```
149149
protocol AsyncReader {
150-
// Callee provides a full buffer; caller processes it
150+
// Callee provides a full buffer; caller drains it
151151
func read(body: (inout buffer) throws -> R) throws -> R
152152
}
153153

0 commit comments

Comments
 (0)