pub trait ParserPlugin {
// Provided methods
fn configure_parser(&mut self, _options: &ParserOptions) { ... }
fn component_processing(&self) -> ComponentProcessing { ... }
fn begin_fragment(&mut self, _context: FragmentContext<'_>) { ... }
fn component_built(
&mut self,
_context: ComponentBuildContext<'_>,
) -> Result<()> { ... }
fn process_attribute(
&mut self,
_context: AttributeContext<'_>,
) -> AttributeAction { ... }
fn finish_opening_tag(
&mut self,
_context: ElementStartContext<'_>,
) -> Option<Vec<u8>> { ... }
fn finish(self: Box<Self>) -> Result<ParserPluginArtifacts> { ... }
}Expand description
A parser plugin that can customize template parsing behavior.
Plugins receive callbacks at explicit lifecycle points: parser setup, fragment start, component build, attribute processing, opening-tag completion, and build completion. Every callback has a no-op default.
WebUI calls these hooks during parsing; plugins decide what (if anything) to do.
Provided Methods§
Sourcefn configure_parser(&mut self, _options: &ParserOptions)
fn configure_parser(&mut self, _options: &ParserOptions)
Configure the plugin before parsing or component registration begins.
Sourcefn component_processing(&self) -> ComponentProcessing
fn component_processing(&self) -> ComponentProcessing
Return static component-processing behavior.
Sourcefn begin_fragment(&mut self, _context: FragmentContext<'_>)
fn begin_fragment(&mut self, _context: FragmentContext<'_>)
Called before parsing begins for a fragment.
Plugins can use this to reset fragment-local counters while preserving global build-level state such as tracked component templates.
Sourcefn component_built(&mut self, _context: ComponentBuildContext<'_>) -> Result<()>
fn component_built(&mut self, _context: ComponentBuildContext<'_>) -> Result<()>
Called after a component template is fully built.
§Errors
Returns an error when the plugin cannot compile or retain the component.
Sourcefn process_attribute(
&mut self,
_context: AttributeContext<'_>,
) -> AttributeAction
fn process_attribute( &mut self, _context: AttributeContext<'_>, ) -> AttributeAction
Process one authored attribute.
Sourcefn finish_opening_tag(
&mut self,
_context: ElementStartContext<'_>,
) -> Option<Vec<u8>>
fn finish_opening_tag( &mut self, _context: ElementStartContext<'_>, ) -> Option<Vec<u8>>
Called after all attributes on an opening tag have been processed.
Returns optional opaque bytes to emit as a Plugin protocol fragment.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".