pub struct WebUIHandler { /* private fields */ }Expand description
The main WebUI handler that processes protocols and renders them.
The handler is stateless: plugin instances are created per-render from
the stored factory function, allowing concurrent renders with &self.
Implementations§
Source§impl WebUIHandler
impl WebUIHandler
Sourcepub fn stream_response<'a, W>(
&'a self,
protocol: &'a Protocol,
options: &RenderOptions<'a>,
writer: &'a mut W,
) -> Result<StreamingResponse<'a, W>, HandlerError>where
W: FlushWriter + ?Sized,
pub fn stream_response<'a, W>(
&'a self,
protocol: &'a Protocol,
options: &RenderOptions<'a>,
writer: &'a mut W,
) -> Result<StreamingResponse<'a, W>, HandlerError>where
W: FlushWriter + ?Sized,
Create a runtime-discovered progressive response.
Source§impl WebUIHandler
impl WebUIHandler
Sourcepub fn render_streaming<'a, W>(
&self,
protocol: &'a Protocol,
state: &Value,
options: &RenderOptions<'a>,
writer: &'a mut W,
) -> Result<(), HandlerError>where
W: FlushWriter + ?Sized,
pub fn render_streaming<'a, W>(
&self,
protocol: &'a Protocol,
state: &Value,
options: &RenderOptions<'a>,
writer: &'a mut W,
) -> Result<(), HandlerError>where
W: FlushWriter + ?Sized,
Render every runtime boundary in document order as final.
Drives the same start → resume → advance → … cycle the public step
machine exposes, against one frozen snapshot: the value is snapshotted
when the response starts and every occurrence commits against that
snapshot, so a large state is projected once per response rather than
re-merged once per boundary. Having no host to hand bytes to between a
commit and the parent bytes that follow it, the helper fuses those two
goals into one continuation setup per boundary; the emitted bytes and
flush positions are identical to driving the steps separately. Hosts
that need asynchronous work — or genuinely new state — between
occurrences should use Self::stream_response or StreamingSession.
Source§impl WebUIHandler
impl WebUIHandler
Sourcepub fn new() -> WebUIHandler
pub fn new() -> WebUIHandler
Create a new WebUI handler with no plugin.
Sourcepub fn with_plugin(factory: fn() -> Box<dyn HandlerPlugin>) -> WebUIHandler
pub fn with_plugin(factory: fn() -> Box<dyn HandlerPlugin>) -> WebUIHandler
Create a new WebUI handler with a plugin factory.
Each render call creates a fresh plugin instance from the factory,
enabling concurrent renders with &self.
Sourcepub fn render<'a>(
&self,
protocol: &'a Protocol,
state: &'a Value,
options: &RenderOptions<'a>,
writer: &'a mut dyn ResponseWriter,
) -> Result<(), HandlerError>
pub fn render<'a>( &self, protocol: &'a Protocol, state: &'a Value, options: &RenderOptions<'a>, writer: &'a mut dyn ResponseWriter, ) -> Result<(), HandlerError>
Render the UI based on the protocol and state.
Trait Implementations§
Source§impl Default for WebUIHandler
impl Default for WebUIHandler
Source§fn default() -> WebUIHandler
fn default() -> WebUIHandler
Auto Trait Implementations§
impl Freeze for WebUIHandler
impl RefUnwindSafe for WebUIHandler
impl Send for WebUIHandler
impl Sync for WebUIHandler
impl Unpin for WebUIHandler
impl UnsafeUnpin for WebUIHandler
impl UnwindSafe for WebUIHandler
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