-
Notifications
You must be signed in to change notification settings - Fork 343
Open
Assignees
@yoshuawuyts
Description
With #380 landed, we should update the tutorial to use them. This would remove the final dependency on futures-rs
(and importantly: Sink
) which should be a big step up in terms of usability.
Also we should consider moving from select! {}
to Stream::merge
. From chat with @skade we've figured out how to "send a close
message after a stream has been exhausted":
enum EventKind { Event(/* event_type */), Shutdown, } let events = events.map(|ev| EventKind::Event(ev)).join(stream::once(EventKind::Shutdown)); let shutdown = shutdown.map(|e| EventKind::Event(e)); let s = events.merge(shutdown); while let Some(event) = s.next().await { match event { EventKind::Event(ev) => /* handle event */, EventKind::Shutdown => /* handle shutdown */, } }
@skade I'm assigning this to you as you've been working on updating this recently. Feel free to unassign yourself if you don't think you'll have bandwidth. Thanks!