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 with_plugin(factory: fn() -> Box<dyn HandlerPlugin>) -> Self
pub fn with_plugin(factory: fn() -> Box<dyn HandlerPlugin>) -> Self
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 handle<'a>(
&self,
protocol: &'a WebUIProtocol,
state: &'a Value,
options: &RenderOptions<'a>,
writer: &'a mut dyn ResponseWriter,
) -> Result<()>
pub fn handle<'a>( &self, protocol: &'a WebUIProtocol, state: &'a Value, options: &RenderOptions<'a>, writer: &'a mut dyn ResponseWriter, ) -> Result<()>
Process a WebUI protocol with the provided state and write the output to the given writer.
options.entry_id selects the fragment to start rendering from.
options.request_path controls server-side route matching.
Sourcepub fn handle_as_component<'a>(
&self,
protocol: &'a WebUIProtocol,
state: &'a Value,
entry_id: &'a str,
writer: &'a mut dyn ResponseWriter,
) -> Result<()>
pub fn handle_as_component<'a>( &self, protocol: &'a WebUIProtocol, state: &'a Value, entry_id: &'a str, writer: &'a mut dyn ResponseWriter, ) -> Result<()>
Like handle(), but pushes a component scope so the plugin emits
binding markers. Use this when rendering a component outside the
normal page render flow (e.g., re-rendering a route component with
modified state).
Sourcepub fn render<'a>(
&self,
protocol: &'a WebUIProtocol,
state: &'a Value,
options: &RenderOptions<'a>,
writer: &'a mut dyn ResponseWriter,
) -> Result<()>
pub fn render<'a>( &self, protocol: &'a WebUIProtocol, state: &'a Value, options: &RenderOptions<'a>, writer: &'a mut dyn ResponseWriter, ) -> Result<()>
Render the UI based on the protocol and state.
Like handle() but does not call writer.end().