pub struct StreamingResponse<'a, W>where
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> StreamingResponse<'_, W>where
W: FlushWriter + ?Sized,
impl<W> StreamingResponse<'_, W>where
W: FlushWriter + ?Sized,
Sourcepub fn start(&mut self, state: &Value) -> Result<StreamStatus, HandlerError>
pub fn start(&mut self, state: &Value) -> Result<StreamStatus, HandlerError>
Render until the first runtime boundary occurrence or terminal.
Sourcepub fn resume(
&mut self,
instance_id: BoundaryInstanceId,
state: &Value,
mode: BoundaryMode,
) -> Result<StreamStatus, HandlerError>
pub fn resume( &mut self, instance_id: BoundaryInstanceId, state: &Value, mode: BoundaryMode, ) -> Result<StreamStatus, HandlerError>
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, HandlerError>
pub fn advance(&mut self) -> Result<StreamStatus, HandlerError>
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<(), HandlerError>
pub fn update( &mut self, instance_id: BoundaryInstanceId, patch: &Value, ) -> Result<(), HandlerError>
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.
Auto Trait Implementations§
impl<'a, W> !RefUnwindSafe for StreamingResponse<'a, W>
impl<'a, W> !Sync for StreamingResponse<'a, W>
impl<'a, W> !UnwindSafe for StreamingResponse<'a, W>
impl<'a, W> Freeze for StreamingResponse<'a, W>
impl<'a, W> Send for StreamingResponse<'a, W>
impl<'a, W> Unpin for StreamingResponse<'a, W>
impl<'a, W> UnsafeUnpin for StreamingResponse<'a, W>where
StreamingSink<'a, W>: UnsafeUnpin,
W: ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more