pub struct Component {
pub name: String,
pub template: String,
pub island_js: Option<String>,
pub style_css: Option<String>,
}Expand description
One loaded component.
Fields§
§name: String§template: String§island_js: Option<String>§style_css: Option<String>Implementations§
Source§impl Component
impl Component
Sourcepub fn from_parts(
name: impl Into<String>,
template: impl Into<String>,
island_js: Option<String>,
style_css: Option<String>,
) -> Self
pub fn from_parts( name: impl Into<String>, template: impl Into<String>, island_js: Option<String>, style_css: Option<String>, ) -> Self
Build a component from its raw parts (used by BOTH project discovery and the embedded built-in loader).
Sourcepub fn render(&self, ctx: &DirectiveContext) -> Result<String, ComponentError>
pub fn render(&self, ctx: &DirectiveContext) -> Result<String, ComponentError>
Render this component for one directive instance to HTML.
The template is registered under a .html name so minijinja’s default
auto-escape callback HTML-escapes {{ attrs.x }} / {{ label }}. The
already-rendered inner markdown is exposed as content, so a template
author writes {{ content | safe }} to splice block content raw.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnsafeUnpin for Component
impl UnwindSafe for Component
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more