pub struct PluginRegistry<App: 'static = ()> { /* private fields */ }Expand description
Holds every registered Plugin and runs their hooks at the right times.
App is the optional application-wide shared state type; plugins may read
it but never mutate it directly. A registry is cheap to clone (inner Rc).
Implementations§
Source§impl<App: 'static> PluginRegistry<App>
impl<App: 'static> PluginRegistry<App>
Sourcepub fn register<P: Plugin + 'static>(&mut self, plugin: P) -> &'static str
pub fn register<P: Plugin + 'static>(&mut self, plugin: P) -> &'static str
Registers a plugin, storing its initial state. Returns the plugin’s name
so callers can wire up its Context if
desired. Panics if a plugin with the same name is already registered.
Sourcepub fn register_with_state<P: Plugin + 'static>(
&mut self,
plugin: P,
state: P::State,
) -> &'static str
pub fn register_with_state<P: Plugin + 'static>( &mut self, plugin: P, state: P::State, ) -> &'static str
Registers a plugin together with an existing shared state value.
Sourcepub fn run_before_render_hooks(&self, app: Option<&App>)
pub fn run_before_render_hooks(&self, app: Option<&App>)
Runs every plugin’s on_before_render hook.
Sourcepub fn run_render_hooks(&self, app: Option<&App>)
pub fn run_render_hooks(&self, app: Option<&App>)
Runs every plugin’s on_render hook, then advances the render counter.
Sourcepub fn run_shutdown_hooks(&self, app: Option<&App>)
pub fn run_shutdown_hooks(&self, app: Option<&App>)
Runs every plugin’s on_shutdown hook.
Sourcepub fn bump_render_count(&self)
pub fn bump_render_count(&self)
Advances the internal render counter (called by the host once per
completed render). run_render_hooks does not do this itself so the
count is stable for the duration of a render.