Skip to main content

BundleInterface

Trait BundleInterface 

Source
pub trait BundleInterface: Send + Sync {
    // Required method
    fn name(&self) -> &'static str;

    // Provided methods
    fn dependencies(&self) -> &'static [&'static str] { ... }
    fn build(&self) -> Result<(), KernelError> { ... }
    fn boot(&self) -> Result<(), KernelError> { ... }
    fn shutdown(&self) -> Result<(), KernelError> { ... }
}
Expand description

Composition unit registered on a Kernel.

Bundles declare Self::dependencies; the kernel topologically sorts them before build / boot so dependents run after their dependencies. Default implementations are no-ops so an empty bundle is valid.

BundleInterface is the Symfony-shaped name; Bundle is the same trait.

Required Methods§

Source

fn name(&self) -> &'static str

Stable unique name used for duplicate detection and error reports.

Provided Methods§

Source

fn dependencies(&self) -> &'static [&'static str]

Bundle names that must compile and boot before this one.

Empty by default. Unknown names and cycles fail at crate::Kernel::compile.

Source

fn build(&self) -> Result<(), KernelError>

Compile-time wiring (register services on the DI container).

§Errors

Return KernelError when the bundle cannot be compiled.

Source

fn boot(&self) -> Result<(), KernelError>

Runtime warmup after the kernel has compiled.

§Errors

Return KernelError when the bundle cannot start.

Source

fn shutdown(&self) -> Result<(), KernelError>

Ordered teardown after Kernel::shutdown.

§Errors

Return KernelError when teardown fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§