#[derive(Future, Stream, Sink, AsyncRead, AsyncWrite)] for enums.
Add this to your Cargo.toml
:
toml
[dependencies]
futures-enum = "0.1.5"
The current version of futures-enum requires Rust nightly 2019-02-15 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.
In futures-enum 0.1.3 or later, it 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 codeSee this issue for other traits.
Licensed 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.