Skip to main content

RuntimePlugin

Trait RuntimePlugin 

Source
pub trait RuntimePlugin:
    Send
    + Sync
    + 'static {
    // Required method
    fn register(&self, r: &mut Registrar, cx: &InitCx) -> Result<(), Error>;

    // Provided method
    fn shutdown(&self) { ... }
}
Expand description

What a runtime plugin does.

One instance serves the whole process and register takes &self, so a plugin holding mutable state brings its own lock (the Send + Sync bound is what makes that explicit).

Required Methods§

Source

fn register(&self, r: &mut Registrar, cx: &InitCx) -> Result<(), Error>

Declare what the plugin offers. Runs once, before the app’s scripts load; failing here fails the module’s load and the app carries on without it.

Provided Methods§

Source

fn shutdown(&self)

Release what the plugin owns. Runs once, when the app is going down. The default does nothing.

Implementors§