pub struct Application { /* private fields */ }Expand description
Application structure that holds modules and dependencies
This struct represents the main application with all its modules, services, and database connections configured.
Implementations§
Source§impl Application
impl Application
Sourcepub fn service_container(&self) -> &ServiceContainer
pub fn service_container(&self) -> &ServiceContainer
Gets a reference to the service container
Sourcepub async fn health_check(&self) -> HashMap<String, bool>
pub async fn health_check(&self) -> HashMap<String, bool>
Performs health checks on all modules
Sourcepub async fn run(self, addr: &str) -> ModuleResult<()>
pub async fn run(self, addr: &str) -> ModuleResult<()>
Sourcepub async fn run_with_shutdown<F>(
self,
addr: &str,
shutdown_signal: F,
) -> ModuleResult<()>
pub async fn run_with_shutdown<F>( self, addr: &str, shutdown_signal: F, ) -> ModuleResult<()>
Runs the application with graceful shutdown support
This starts the Axum HTTP server and handles graceful shutdown when a shutdown signal is received.
§Arguments
addr- The socket address to bind toshutdown_signal- A future that completes when shutdown is requested
§Example
ⓘ
let app = ApplicationBuilder::new()
.with_module(my_module)
.build()
.await?;
app.run_with_shutdown("0.0.0.0:3000", async {
tokio::signal::ctrl_c().await.ok();
}).await?;Sourcepub fn into_router(self) -> Router
pub fn into_router(self) -> Router
Returns the configured router for use with custom server setup
Use this when you need more control over the server configuration.
Auto Trait Implementations§
impl !RefUnwindSafe for Application
impl !UnwindSafe for Application
impl Freeze for Application
impl Send for Application
impl Sync for Application
impl Unpin for Application
impl UnsafeUnpin for Application
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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