Skip to main content

ModuleReload

Trait ModuleReload 

Source
pub trait ModuleReload:
    Send
    + Sync
    + 'static {
    // Required methods
    fn reload(
        &self,
        ctx: &Arc<Context>,
        plugin: &str,
    ) -> Result<(), CordisError>;
    fn rollback(
        &self,
        ctx: &Arc<Context>,
        plugin: &str,
    ) -> Result<(), CordisError>;
}
Expand description

Apply seam between the graph and whatever actually re-instantiates a plugin (loader re-apply, HMR swap, test double).

reload brings plugin to its new state; rollback re-registers the PREVIOUS state after a failed reload, restoring the last-known-good configuration. Implementations must be idempotent per call site — the graph invokes each exactly once per affected plugin per transaction.

Required Methods§

Source

fn reload(&self, ctx: &Arc<Context>, plugin: &str) -> Result<(), CordisError>

Reload plugin to reflect the settled change batch.

Source

fn rollback(&self, ctx: &Arc<Context>, plugin: &str) -> Result<(), CordisError>

Re-register the plugin’s previous state after a failed reload.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§