Skip to content

Proposal: add stream::OptionStream #2737

Open
@dodomorandi

Description

@dodomorandi

I would like to propose the addition of a new abstraction: OptionStream. I would expect it to have the same Item as the underlying stream when it's built from an Option::Some variant, and to always return Poll::Pending Poll::Ready(None) (see my comment below) when it's built from Option::None.

The abstraction is useful when you need to enable/disable a particular stream (i.e. an IntervalStream) while keeping the same stream type.

Here Here you can find a simple implementation, in case it could make things more clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-streamArea: futures::streamC-feature-requestS-needs-api-designStatus: Before implementing this, a discussion or decision on the new API is needed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions