Skip to main content

Component

Trait Component 

Source
pub trait Component:
    Send
    + Sync
    + 'static {
    // Required method
    fn run<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        cx: &'life1 ComponentContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<ComponentOutput, ThemeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn properties(&self) -> Vec<PropertyDef> { ... }
    fn markup(&self) -> Option<&'static str> { ... }
}
Expand description

A compiled unit a page attaches.

Required Methods§

Source

fn run<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, cx: &'life1 ComponentContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<ComponentOutput, ThemeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Produces the data for one request.

Provided Methods§

Source

fn properties(&self) -> Vec<PropertyDef>

The properties an attachment may set.

Source

fn markup(&self) -> Option<&'static str>

The component’s default markup, rendered by component("alias") when the theme has no partials/<alias>/default.htm of its own. It reads the component’s data as component and as the alias.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§