Skip to main content

HtmlParser

Struct HtmlParser 

Source
pub struct HtmlParser { /* private fields */ }
Expand description

Parser for WebUI directives.

Implementations§

Source§

impl HtmlParser

Source

pub fn new() -> Self

Create a new directive parser.

Source

pub fn with_plugin(plugin: Box<dyn ParserPlugin>) -> Self

Create a new parser with a plugin for framework-specific behavior.

Source

pub fn set_css_strategy(&mut self, strategy: CssStrategy) -> &mut Self

Set the CSS strategy for component stylesheet delivery.

Source

pub fn component_registry_mut(&mut self) -> &mut ComponentRegistry

Get a mutable reference to the component registry.

Source

pub fn into_fragment_records(self) -> WebUIFragmentRecords

Source

pub fn has_fragment(&self, fragment_id: &str) -> bool

Check if a fragment ID has been parsed (exists in the fragment records).

Source

pub fn take_plugin(&mut self) -> Option<Box<dyn ParserPlugin>>

Take the parser plugin. Call before into_fragment_records() if you need access to plugin state (e.g., component templates).

Source

pub fn plugin_mut(&mut self) -> Option<&mut dyn ParserPlugin>

Get a mutable reference to the parser plugin.

Source

pub fn take_tokens(&mut self) -> Vec<String>

Take the accumulated CSS tokens as a sorted, deduplicated Vec.

Tokens that are defined in inline <style> tags (e.g., in a :root block) are excluded — only externally-referenced tokens that the app does not already define are returned.

This consumes the internal token store. Call after parsing is complete.

Source

pub fn parse(&mut self, fragment_id: &str, html_content: &str) -> Result<()>

Parse HTML content to generate WebUI fragments.

Trait Implementations§

Source§

impl Default for HtmlParser

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.