Crates.io | futures-either |
lib.rs | futures-either |
version | 0.1.0 |
source | src |
created_at | 2020-08-31 18:42:56.754282 |
updated_at | 2020-09-04 14:18:52.562294 |
description | A way to await on the output of either of two futures |
homepage | https://github.com/r3v2d0g/futures-either |
repository | https://git.r3vd5u3d.network/~r3v2d0g/futures-either |
max_upload_size | |
id | 283189 |
size | 32,481 |
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));
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/.