pub struct Inbound {
pub sys: Receiver<(Direction, SystemFrame)>,
pub data: Receiver<DataFrame>,
}Expand description
The receive surface of a stage: a preempting system lane and the data lane.
Within a lane, frames keep FIFO order. Across lanes, sys always wins, so a
system frame is taken even when data is backed up.
Fields§
§sys: Receiver<(Direction, SystemFrame)>System-tier frames (lifecycle, interruption, errors). Drained first.
Error rides this lane upstream; Interrupt/Start/Stop ride it
downstream. Sparse and latency-critical.
data: Receiver<DataFrame>Data-tier frames (media, transcripts), in FIFO order, downstream only.
Implementations§
Source§impl Inbound
impl Inbound
Sourcepub async fn recv(&mut self) -> Option<Received>
pub async fn recv(&mut self) -> Option<Received>
Receive the next frame, draining the system lane before the data lane.
Returns Received::Sys or Received::Data, or None once both
lanes are closed — the run-loop’s shutdown signal.
futures::select_biased polls sys first, so a system frame preempts
any data backlog deterministically. When a lane closes, its receiver
(a FusedStream) yields None; the loop swallows that first None
so the next iteration just skips the dead lane instead of treating it as
shutdown. This is so the sys lane can keep draining even after the data
lane shuts down — None is returned only once both lanes have closed.
Sourcepub fn flush_data(&mut self) -> Vec<DataFrame>
pub fn flush_data(&mut self) -> Vec<DataFrame>
Drain everything currently queued on the data lane. Frames where
survives_flush() is false are dropped; survivors are returned in the
order they arrived, for the caller to re-process. Does not block and does
not touch the sys lane.