Skip to main content

WebUIHandler

Struct WebUIHandler 

Source
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

Source

pub fn stream_response<'a, W: FlushWriter + ?Sized>( &'a self, protocol: &'a Protocol, options: &RenderOptions<'a>, writer: &'a mut W, ) -> Result<StreamingResponse<'a, W>>

Start a host-driven progressive HTML response.

§Errors

Returns an error when the entry is missing or its compiled streaming structure is malformed.

Source§

impl WebUIHandler

Source

pub fn render_streaming<'a, W: FlushWriter + ?Sized>( &self, protocol: &'a Protocol, state: &Value, options: &RenderOptions<'a>, writer: &'a mut W, ) -> Result<()>

Render an opt-in progressive hydration response.

Boundary signals are validated in document order and every committed checkpoint is flushed through writer. Unlike Self::render, this mode emits boundary envelopes instead of a page-wide #webui-data block and requires structural head_start and body_end signals.

Source§

impl WebUIHandler

Source

pub fn new() -> Self

Create a new WebUI handler with no plugin.

Source

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.

Source

pub fn render<'a>( &self, protocol: &'a Protocol, state: &'a Value, options: &RenderOptions<'a>, writer: &'a mut dyn ResponseWriter, ) -> Result<()>

Render the UI based on the protocol and state.

Trait Implementations§

Source§

impl Default for WebUIHandler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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, 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.