pub struct BusReceiver { /* private fields */ }Expand description
The receiving half of a Bus, held by whoever owns the pipeline.
Draining it blocks until every Bus sender has been dropped, which is how
a caller waits for a pipeline to actually finish rather than polling for it.
Implementations§
Source§impl BusReceiver
impl BusReceiver
Sourcepub fn recv(&self) -> Option<BusEvent>
pub fn recv(&self) -> Option<BusEvent>
Blocks until the next event arrives.
Returns None only after every corresponding Bus sender has been
dropped and all already-queued events have been received. This discards
the posting element’s stable graph ID; use Self::recv_message when
duplicate element names must be distinguished.
Sourcepub fn try_recv(&self) -> Option<BusEvent>
pub fn try_recv(&self) -> Option<BusEvent>
Receives one currently queued event without blocking.
Returns None both when the channel is currently empty and when every
sender has disconnected. Use Self::try_recv_message to retain the
posting element’s stable graph ID.
Sourcepub fn iter(&self) -> impl Iterator<Item = BusEvent> + '_
pub fn iter(&self) -> impl Iterator<Item = BusEvent> + '_
Iterates over events until every corresponding Bus sender drops.
The iterator blocks while the channel is still connected but empty.
It discards stable graph IDs; use Self::iter_with_ids when duplicate
element names must be distinguished.
Sourcepub fn recv_message(&self) -> Option<BusMessage>
pub fn recv_message(&self) -> Option<BusMessage>
Blocks until the next event and its stable posting-element ID arrive.
Returns None after the channel disconnects and its queued messages
have been drained.
Sourcepub fn try_recv_message(&self) -> Option<BusMessage>
pub fn try_recv_message(&self) -> Option<BusMessage>
Receives one currently queued message without blocking.
Returns None for both an empty connected channel and a disconnected
channel.
Sourcepub fn iter_with_ids(&self) -> impl Iterator<Item = BusMessage> + '_
pub fn iter_with_ids(&self) -> impl Iterator<Item = BusMessage> + '_
Iterates over messages, preserving stable graph element IDs, until all
corresponding Bus senders have been dropped.
The iterator blocks while the channel remains connected but empty.
Sourcepub fn log_events(&self)
pub fn log_events(&self)
Blocks and prints events in a common default format ([name] eos,
[name] error: ..., [name] dropped a buffer (queue full),
[name] seeked: requested ... landed ...) until every corresponding
Bus sender has been dropped. This consumes both events already
queued and events posted while the call is waiting; use
BusReceiver::try_recv to drain only what is currently available.
Convenience for examples and smoke tests; anything that needs to
act on specific events — e.g. deciding whether an Error warrants
a crate::pipeline::Pipeline::stop — should match on iter()
directly instead, where error’s concrete variant (see
crate::error::Error) is still available, not just its
Display text.