Skip to content

buffer_unordered footgun: 0 futures #2939

Closed
@BatmanAoD

Description

@BatmanAoD

If n=0 for StreamExt::buffer_unordered(n), then waiting for the stream to complete simply hangs, even if the stream itself is empty. This is a footgun (we ran into it when using len() as the argument to buffer_unordered).

As a breaking change, n could be of type NonZeroUsize instead of usize. As a non-breaking change, would it be possible to make the future complete immediately in the case where the actual underlying stream is empty?

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