Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required method
    fn name(&self) -> &str;

    // Provided methods
    fn on_init<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut InitContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_build_start<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut BuildContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_content_parsed<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut ContentContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_graph_updated<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut GraphContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_validation_complete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut ValidationContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_page_render<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut RenderContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_build_complete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut OutputContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn on_file_changed<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut WatchContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

The core plugin trait. All lifecycle hooks have default no-op implementations.

Plugins can be implemented in Rust (loaded as cdylib) or in TypeScript (proxied via Deno).

Required Methods§

Source

fn name(&self) -> &str

The plugin’s unique name.

Provided Methods§

Source

fn on_init<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut InitContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called once when the plugin is first loaded.

Source

fn on_build_start<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut BuildContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called at the start of each build.

Source

fn on_content_parsed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut ContentContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called after each content file is parsed.

Source

fn on_graph_updated<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut GraphContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called after all content is ingested into the RDF graph.

Source

fn on_validation_complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut ValidationContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called after SHACL validation completes.

Source

fn on_page_render<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut RenderContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called before rendering each page.

Source

fn on_build_complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut OutputContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called after all output files are written.

Source

fn on_file_changed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 mut WatchContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called when a file change is detected during dev server.

Implementors§