#[derive(Future, Stream, Sink, AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead)] for enums.
Add this to your Cargo.toml
:
toml
[dependencies]
futures-enum = "0.1.8"
The current futures-enum requires Rust 1.36 or later.
```rust use futures::future::{self, Future}; use futures_enum::*;
enum Either { A(A), B(B), }
fn foo(x: i32) -> impl Future
See auto_enums for how to automate patterns like this.
futures-enum works well even if the dependency contains only sub-crates such as futures-core
, futures-util
, etc.
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.