Skip to main content

Inbound

Struct Inbound 

Source
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

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.