one-of-futures 0.1.1

Future-aware Either-like type with multiple variants
docs.rs failed to build one-of-futures-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: one-of-futures-0.1.4

one-of-futures

Crates.io MIT licensed Build Status

Overview

This crate implements several custom future-aware OneOf types, which behaves similarly to Either type, but suitable for more than two variants.

It also exposes impl_one_of! macro, which allows generating custom OneOf type, with the desired number and names of variants

Usage

Add this to your Cargo.toml:

[dependencies]
one-of-futures = "0.1"

Example

use one_of_futures::impl_one_of;

impl_one_of!(MyEither;
  Left,
  Right
);

fn main() {
  let either = match 1 {
      0 => MyEither::Left(async { 1 }),
      _ => MyEither::Right(async { 2 }),
  };
}