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 with default parser options.

Source

pub fn with_options(options: impl Into<ParserOptions>) -> Self

Create a new directive parser with explicit parser options.

Source

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

Create a new parser with a plugin and default parser options.

Source

pub fn with_plugin_options( plugin: Box<dyn ParserPlugin>, options: impl Into<ParserOptions>, ) -> Self

Create a new parser with a plugin and explicit parser options.

Source

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

Get a mutable reference to the component registry.

Source

pub fn component_registry(&self) -> &ComponentRegistry

Get a shared reference to the component registry.

Source

pub fn into_fragment_records(self) -> WebUIFragmentRecords

Source

pub fn take_warnings(&mut self) -> Vec<Diagnostic>

Take non-fatal parser warnings collected so far.

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 module_entry_srcs(&self) -> &[String]

src of every authored <script type="module"> outside any <boundary>, in document order, from the most recent top-level HtmlParser::parse call.

These are the page’s critical module entries — the ones whose shared chunks belong in <link rel="modulepreload">. Island loaders placed inside a boundary are excluded, because deferring them is the point.

A src containing {{ is skipped: it is a binding resolved per request, so no build-time artifact can be matched to it.

Source

pub fn component_shadow_dom_usage(&self) -> impl Iterator<Item = (&str, bool)>

Iterate component tags and whether each effectively uses Shadow DOM.

This remains available independently of parser plugins so protocol builders can persist effective per-component ownership in plugin-free builds.

Source

pub fn component_work_policies(&self) -> impl Iterator<Item = (&str, u8)>

Iterate non-eager component work-policy codes.

Source

pub fn take_plugin_artifacts(&mut self) -> Result<ParserPluginArtifacts>

Take any post-parse artifacts captured by the parser plugin.

§Errors

Returns ParserError::Template if a tracked component contains an invalid @event handler or a non-braced w-ref binding.

Source

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

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

Convenience wrapper around HtmlParser::token_analysis.

Source

pub fn token_analysis(&self) -> CssTokenAnalysis

Analyze CSS token requirements from the parsed fragment/component graph.

Each token candidate in a var() fallback chain is removed when covered by a same-block definition or an unconditional root/host default in the current fragment or an ancestor component/root. The returned list is sorted and deduplicated from the remaining unresolved candidates.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.