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 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_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 that token is defined by CSS in the current fragment or an ancestor component/root. The returned protocol token list is sorted and deduplicated from the remaining unresolved fallback-chain 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 = 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.