Skip to main content

Plugin

Trait Plugin 

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

    // Provided methods
    fn on_start(&self, _config: &Config) { ... }
    fn middleware(&self) -> Vec<Arc<dyn Middleware>> { ... }
    fn head(&self) -> Option<String> { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Unique name, used in logs and for [plugins.<name>] configuration.

Provided Methods§

Source

fn on_start(&self, _config: &Config)

Called once when the application is built.

Source

fn middleware(&self) -> Vec<Arc<dyn Middleware>>

Middleware added after the application’s global middleware.

Source

fn head(&self) -> Option<String>

Trusted markup appended to every document <head>.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§