pub struct StreamingResponse<'a, W: FlushWriter + ?Sized> { /* private fields */ }Expand description
A progressive response that writes directly through a FlushWriter.
Steps alternate: Self::start writes the shell prefix and stops before
the first occurrence, Self::resume writes exactly one occurrence through
its checkpoint, and Self::advance writes the ordinary parent bytes that
follow it until the next occurrence or the terminal. Every step is one
independently writable, independently flushed segment.
Implementations§
Source§impl<W: FlushWriter + ?Sized> StreamingResponse<'_, W>
impl<W: FlushWriter + ?Sized> StreamingResponse<'_, W>
Sourcepub fn start(&mut self, state: &Value) -> Result<StreamStatus>
pub fn start(&mut self, state: &Value) -> Result<StreamStatus>
Render until the first runtime boundary occurrence or terminal.
Sourcepub fn resume(
&mut self,
instance_id: BoundaryInstanceId,
state: &Value,
mode: BoundaryMode,
) -> Result<StreamStatus>
pub fn resume( &mut self, instance_id: BoundaryInstanceId, state: &Value, mode: BoundaryMode, ) -> Result<StreamStatus>
Commit the pending occurrence through its checkpoint, then stop.
The bytes written by this call are exactly the occurrence’s own record —
no parent or tail bytes follow it — so the host can release the
occurrence the moment it resolves. Call Self::advance next.
BoundaryMode::Updatable is refused once the response has committed
as many updatable occurrences as the browser retains. The refusal is
raised before any byte or state moves, so the same occurrence stays
pending and can be committed with BoundaryMode::Final instead.
Sourcepub fn advance(&mut self) -> Result<StreamStatus>
pub fn advance(&mut self) -> Result<StreamStatus>
Write the ordinary parent bytes that follow a committed occurrence.
Valid only after Self::resume. Renders the shell until the next
occurrence suspends or the terminal record completes.
Sourcepub fn update(
&mut self,
instance_id: BoundaryInstanceId,
patch: &Value,
) -> Result<()>
pub fn update( &mut self, instance_id: BoundaryInstanceId, patch: &Value, ) -> Result<()>
Emit one projected state update for a committed updatable occurrence.
Valid between Self::resume and Self::advance as well as after
the response has moved on, so a host can revise the occurrence it just
committed while the response is still open.