futures-either

Crates.iofutures-either
lib.rsfutures-either
version0.1.0
sourcesrc
created_at2020-08-31 18:42:56.754282
updated_at2020-09-04 14:18:52.562294
descriptionA way to await on the output of either of two futures
homepagehttps://github.com/r3v2d0g/futures-either
repositoryhttps://git.r3vd5u3d.network/~r3v2d0g/futures-either
max_upload_size
id283189
size32,481
Matthieu Le brazidec (r3v2d0g) (r3v2d0g)

documentation

https://docs.rs/futures-either

README

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

img img img

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));

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Commit count: 0

cargo fmt