Skip to content

doc: Either could use an example #2276

@graydon

Description

@graydon

The docs on the Either enum are fairly unclear (as in: how to use it, what it's for).

An example would do wonders, say one that shows what you need to write if you want to construct a single future that is the merger of two futures chosen (conditionally) at-present:

if cond {
    Either::Left(async { ... })
} else {
    Either::Right(async { ... })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions