-
Notifications
You must be signed in to change notification settings - Fork 420
create watch_prefix_sink() (was: Impl Stream for Subscriber) #1311
Copy link
Copy link
Open
Labels
Description
Use Case: Use Subscriber as if it were a Stream of Events instead of a Future of a single event multiple times.
As the documentation for Future and Stream states:
The Stream trait is similar to Future but can yield multiple values before completing, similar to the Iterator trait from the standard library:
It seems to me that the Future should actually be a Stream, since Subscriber is intended to return some unbounded stream of Events instead of a single event.
Proposed Change: Implement Stream for Subscriber and possibly remove the Future implementation.
Actually, looking at the impl very little code would actually change. I don't entirely understand the motivation for a channel of oneshot channels, but I'm sure there is a very good reason. ( If I had to make a wild-ass guess, I'd say that the inner one-shots are results of not-yet-completed transactions, and, in some cases, the transaction may be aborted, so it doesn't actually contain data)
Who Benefits From The Change(s)? Me. Also new users who are trying to understand how to subscribe to a stream of events.
Alternative Approaches
Keep the multi-use feature, and document it accordingly?
Reactions are currently unavailable