pub struct AppBootstrapper { /* private fields */ }
Expand description
The main bootstrap orchestrator that handles the complete app startup process
This struct provides a fluent API for configuring and starting an elif.rs application:
- Discovers all modules automatically via the compile-time registry
- Resolves module dependencies using ModuleRuntime with enhanced error handling
- Configures the DI container with all providers
- Registers all controllers and their routes
- Sets up middleware pipeline
- Starts the HTTP server
Implementations§
Source§impl AppBootstrapper
impl AppBootstrapper
Sourcepub fn new() -> BootstrapResult<Self>
pub fn new() -> BootstrapResult<Self>
Create a new AppBootstrapper with automatic module discovery
This method:
- Gets all modules from the global compile-time registry
- Converts them to ModuleDescriptors for ModuleRuntime
- Uses ModuleRuntime for enhanced dependency resolution and lifecycle management
- Sets up default configuration
Sourcepub fn with_config(self, config: HttpConfig) -> Self
pub fn with_config(self, config: HttpConfig) -> Self
Configure the HTTP server with custom configuration
Sourcepub fn with_middleware(self, middleware: Vec<Box<dyn Middleware>>) -> Self
pub fn with_middleware(self, middleware: Vec<Box<dyn Middleware>>) -> Self
Add middleware to the application
Sourcepub fn with_container(self, container: IocContainer) -> Self
pub fn with_container(self, container: IocContainer) -> Self
Use a pre-configured DI container
Sourcepub fn listen(
self,
addr: impl Into<SocketAddr> + Send + 'static,
) -> Pin<Box<dyn Future<Output = BootstrapResult<()>> + Send>>
pub fn listen( self, addr: impl Into<SocketAddr> + Send + 'static, ) -> Pin<Box<dyn Future<Output = BootstrapResult<()>> + Send>>
Start the HTTP server on the specified address
This method performs the complete bootstrap sequence:
- Configures the DI container with all module providers using ModuleRuntime
- Creates and configures the router with all controller routes
- Sets up the middleware pipeline
- Starts the HTTP server
Sourcepub fn modules(&self) -> &[CompileTimeModuleMetadata]
pub fn modules(&self) -> &[CompileTimeModuleMetadata]
Get discovered modules (for debugging/introspection)
Sourcepub fn load_order(&self) -> &[String]
pub fn load_order(&self) -> &[String]
Get module load order from ModuleRuntime (for debugging/introspection)
Trait Implementations§
Source§impl Debug for AppBootstrapper
impl Debug for AppBootstrapper
Auto Trait Implementations§
impl Freeze for AppBootstrapper
impl !RefUnwindSafe for AppBootstrapper
impl Send for AppBootstrapper
impl Sync for AppBootstrapper
impl Unpin for AppBootstrapper
impl !UnwindSafe for AppBootstrapper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more