feat(p3): only allow body.stream
calls once
#156
Closed
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.
Only allow
body.stream
to be called once.This simplifies the host implementation and the amount of bookkeeping that would need to be performed by the runtime. I cannot really come up with a use case that would be impossible for guests to implement using the "at-most-once" call semantics.
We can always relax this requirement at a later point of time if it becomes an issue, but we can't quite go the other way round
This is aligned with e.g.:
tcp-socket.receive
https://github.com/WebAssembly/wasi-sockets/blob/41d707935af71418ea5477d5fc9c7281353fa7f5/wit-0.3.0-draft/types.wit#L326-L346tcp-socket.listen
https://github.com/WebAssembly/wasi-sockets/blob/41d707935af71418ea5477d5fc9c7281353fa7f5/wit-0.3.0-draft/types.wit#L226-L289