Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin:
    Send
    + Sync
    + 'static {
    const CONFIGURATION_SCHEMA: Option<&'static str> = None;

    // Required method
    fn create(context: CreateContext) -> Result<Self, String>
       where Self: Sized;

    // Provided methods
    fn requirements() -> &'static [Requirement] { ... }
    fn stop(&self, _context: Ctx) -> Result<(), String> { ... }
}
Expand description

Complete portable Plugin object constructed once per admitted generation.

Provided Associated Constants§

Source

const CONFIGURATION_SCHEMA: Option<&'static str> = None

Portable JSON Schema for this Plugin’s configuration, when it accepts configuration.

Required Methods§

Source

fn create(context: CreateContext) -> Result<Self, String>
where Self: Sized,

Constructs the complete object. Dependency calls use context.ctx().

Provided Methods§

Source

fn requirements() -> &'static [Requirement]

Source-declared named dependencies required by this object.

Source

fn stop(&self, _context: Ctx) -> Result<(), String>

Attempts cleanup once after admitted work has drained.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> Plugin for T
where T: Default + Send + Sync + 'static,