On the tokio chat, @carllerche suggested that one way to simplify the "errors on streams" problem (rust-lang/futures-rs#206) would be to remove the error alternative from Future
& Stream
. This idea stuck with me, and I want to sketch out a possible alternative, to see how it would look.
Future<Item, Error>
: A future resolves to either an item or an error type, exactly like an async version ofResult
.poll() -> Poll<Item, Error>
: not ready, or an item, or an error
Stream<Item, Error>
: A stream emits elements that are each either an item or error, exactly like an async iterable ofResult
.poll() -> Poll<Option<Item>, Error>
: not ready, or the end of the stream (Ready(None)
), or an item, or an error