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() -> Result<AppBootstrapper, BootstrapError>
pub fn new() -> Result<AppBootstrapper, BootstrapError>
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) -> AppBootstrapper
pub fn with_config(self, config: HttpConfig) -> AppBootstrapper
Configure the HTTP server with custom configuration
Sourcepub fn with_middleware(
self,
middleware: Vec<Box<dyn Middleware>>,
) -> AppBootstrapper
pub fn with_middleware( self, middleware: Vec<Box<dyn Middleware>>, ) -> AppBootstrapper
Add middleware to the application
Sourcepub fn with_container(self, container: IocContainer) -> AppBootstrapper
pub fn with_container(self, container: IocContainer) -> AppBootstrapper
Use a pre-configured DI container
Sourcepub fn listen(
self,
addr: impl Into<SocketAddr> + Send + 'static,
) -> Pin<Box<dyn Future<Output = Result<(), BootstrapError>> + Send>>
pub fn listen( self, addr: impl Into<SocketAddr> + Send + 'static, ) -> Pin<Box<dyn Future<Output = Result<(), BootstrapError>> + 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
Source§impl Default for AppBootstrapper
impl Default for AppBootstrapper
Source§fn default() -> AppBootstrapper
fn default() -> AppBootstrapper
Returns the “default value” for a type. Read more
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more