pub trait Plugin: Sized {
// Required method
fn build(self, app: &mut App);
// Provided methods
fn name(&self) -> &'static str { ... }
fn depends_on(&self) -> &'static [&'static str] { ... }
fn cleanup(&mut self, _app: &mut App) { ... }
}Expand description
Plugin trait registered via App::add_plugin.
build consumes self so the implementor can move non-clone payloads (text shapers, async runtimes, sockets) into the world.
Required Methods§
Provided Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Returns the plugin’s name for diagnostics; defaults to the type name.
Sourcefn depends_on(&self) -> &'static [&'static str]
fn depends_on(&self) -> &'static [&'static str]
Returns the list of plugin names this plugin depends on. Default: empty.
App::add_plugin checks each name against the already-installed set and prints a warning for any name it
does not find, then builds the plugin anyway. Ordering is the caller’s responsibility; the topological sort
over a deferred plugin queue is not written yet.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.