Skip to content

There needs to be a way to combine the effects of try_recv and recv_opt #11087

Closed
@mstewartgallus

Description

@mstewartgallus

Before the latest changes at #10830 I could write if port.peek() { match port.try_recv() { ..., now I cannot write equivalent code. One possible solution would be to have a method (let's call it try_opt) that returns an enumeration consisting of either a result or an indication of an empty port or a an indication of a closed port. This solution feels kind of ugly to me though so I'd appreciate suggestions on better solutions.

cc: @alexcrichton

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