[][src]Crate futures_either

A way to await on the output of either of two futures.

Example

use futures_lite::future;
use futures_either::{either, Either};

let out = either(
    async { 42 },
    async { false },
).await;
assert_eq!(out, Either::Left(42));

let out = either(
    future::pending::<bool>(),
    async { 42 },
).await;
assert_eq!(out, Either::Right(42));

Modules

futs

The Futures returned by this crate's functions.

Enums

Either

The enum Either with variants Left and Right is a general purpose sum type with two cases.

Functions

either

Returns a future polling two futures and returning the output of the first one to complete.

either_fair

Returns a future polling two futures and returning the output of the first one to complete.

try_either

Returns a future polling two futures and returning a result with the output or error returned by the first one to complete.

try_either_fair

Returns a future polling two futures and returning a result with the ouput or error returned by the first one to complete.