Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: Stream ownership is cumbersome #1190

Open
alexcrichton opened this issue Mar 3, 2025 · 0 comments
Open

rust: Stream ownership is cumbersome #1190

alexcrichton opened this issue Mar 3, 2025 · 0 comments
Labels
async Related to async/streams in the component model. gen-rust Related to bindings for Rust-compiled-to-WebAssembly

Comments

@alexcrichton
Copy link
Member

Currently streams implement Sink and Stream for Vec<T>, but this has a number of implications:

  • For primitives such as stream<u8> that means that sending chunks of data requires sending chunks of allocations. There's no chance to reuse buffers or otherwise have more efficient buffer handling.
  • For non-primitives such as stream<list<u8>> it's possible that a write doesn't fully send everything. There's no way to recover items which weren't sent in a chunk. I realize right now that write-as-generated writes everything in a loop, but I think this is probably also something worth changing.
  • If a write is cancelled there's no way currently to recover the original chunk of items that were being sent.
@alexcrichton alexcrichton added gen-rust Related to bindings for Rust-compiled-to-WebAssembly async Related to async/streams in the component model. labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async Related to async/streams in the component model. gen-rust Related to bindings for Rust-compiled-to-WebAssembly
Projects
None yet
Development

No branches or pull requests

1 participant