Skip to content

Future version of depleted #13

@kevinresol

Description

@kevinresol

Currently depleted is a Bool value indicating the current stream is depleted. So essentially only an Empty and its derivatives (Future, Compound, etc) will have depleted = true. (Or it should be more accurately named as isEmpty...)

While that is useful for code which iterates the stream, it isn't very useful for code that "observe" the stream. So I would like to suggest adding a property of type Future<Outcome<Noise, Error>> which when happens it means that "the stream's end has been observed". or in other words we can now iterate it in a sync manner.

This is different from iterating the stream myself and handle the result. Because the proposed future remains lazy until "someone else" iterates the stream to an end.

I think of this idea when I was trying to find the right moment to close the socket in tink_tcp.

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