![crates-badge] ![docs-badge] ![license-badge] ![rustc-badge]
#[derive(Future, Stream, Sink, AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead)] for enums.
Add this to your Cargo.toml
:
toml
[dependencies]
futures-enum = "0.1.13"
futures = "0.3"
The current futures-enum requires Rust 1.36 or later.
```rust use futures_enum::*; use std::future::Future;
enum Either { A(A), B(B), }
fn foo(x: i32) -> impl Future
futures-enum works well even if the dependency contains only sub-crates such as futures-core
, futures-io
, futures-sink
, etc.
See auto_enums crate for how to automate patterns like this.
Future
- generated codeStream
- generated codeSink
- generated codeAsyncRead
- generated codeAsyncWrite
- generated codeAsyncSeek
- generated codeAsyncBufRead
- generated codeLicensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.