Expand description
EventStream — the node’s inbox, in four flavours.
Blueprint §9.1: “EventStream implements Iterator + Stream and can
merge external streams. After Stop the stream fuses.” All four ways of
reading it — recv, recv_async,
Iterator and Stream — are the same queue seen through different
doors, so a node can switch styles without changing its wiring.
§Which door to use
| Call | Blocks | Use when |
|---|---|---|
recv | Yes | An ordinary synchronous node loop |
recv_timeout | Yes, bounded | A loop that must do periodic work |
try_recv | No | A node polling its own event loop |
recv_async | No (awaits) | Inside a tokio task |
The blocking doors return NodeError::BlockingInAsync rather than
deadlocking when called from a current-thread runtime — see
crate::runtime.
§A local Stream
This crate defines its own Stream trait rather than depending on
futures-core, which is not on blueprint §18.1’s retained list. It is
signature-identical to futures_core::Stream, so a caller who does have
that crate can write a two-line forwarding adapter — and this crate stays
dependency-clean.
§Fusing
Event::Stop is delivered once and sets the fuse; every later read
returns None. EventStream::is_fused reports it, and
EventStream::stop_cause remembers why.
Structs§
- Event
Stream - The node’s event inbox (blueprint §9.1).
Traits§
- Stream
- An asynchronous sequence of values.