pub trait Plugin:
Sized
+ Send
+ 'static {
// Required method
fn build(self, app: AppBuilder) -> AppBuilder;
// Provided method
fn name(&self) -> Cow<'static, str> { ... }
}Expand description
A reusable Autumn integration that wires itself into an AppBuilder.
See the module-level documentation for conventions and examples.
Required Methods§
Sourcefn build(self, app: AppBuilder) -> AppBuilder
fn build(self, app: AppBuilder) -> AppBuilder
Apply this plugin’s configuration to the builder.
Called exactly once per AppBuilder. Implementations typically chain
AppBuilder::on_startup, AppBuilder::on_shutdown,
AppBuilder::nest, AppBuilder::with_extension and (with the
db feature) AppBuilder::migrations.
Plugins can also install tier-1 subsystem replacements here —
AppBuilder::with_config_loader, AppBuilder::with_pool_provider
(with the db feature), AppBuilder::with_telemetry_provider, and
AppBuilder::with_session_store — which is the canonical way to
distribute a custom subsystem (e.g. AwsSecretsConfigPlugin) for
downstream consumers as a one-line install. See
docs/guide/extensibility.md for the full extensibility model.
Provided Methods§
Sourcefn name(&self) -> Cow<'static, str>
fn name(&self) -> Cow<'static, str>
Stable identifier used for duplicate-registration detection.
Defaults to std::any::type_name of the concrete plugin struct, so
two instances of the same type collide by default. Override to allow
multiple instances of the same type to coexist; the return type is
Cow<'static, str> so plugins can compute a
unique label from runtime configuration without leaking memory.
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.