Skip to content

Rust async support: WIT stream<T> -> Rust stream<Vec<T>> #1152

@mariopasquali

Description

@mariopasquali

I am studying the new async support and trying to figure out the rationale behind the WIT stream<T> translating into Rust stream<Vec<T>> instead of stream<T>.

A common use of async streams in WIT is for sockets and http, where a stream of bytes (chunks) is needed. In this case stream<u8> covers the need, but this could also be achieved by defining a stream<list<T>> in WIT which would translate to stream<Vec<u8>> in Rust. On the other hand, a stream of complex records which should be processed individually cannot be expressed with a WIT stream, as this would result in a stream of complex records chunks.

Wouldn't it be more universal to define as WIT stream<T> as a Rust stream<T>, to cover all use cases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions