iet-app
core contracts official
Defines Module, Worker, and Runtime and the Application builder that prepares and drains them.
CoreFeaturesIntegrationsStacksTooling
Used byiet-db-timescaleiet-http-axumiet-runtime-tokio
iet-appcontractsLifecycle contracts and compositionDepends oniet-corecontractiet-configcontract
How to use it
iet-app composes a process statically: each Module validates configuration and prepares an owned Worker, a Runtime starts and drains those workers, and the health registry exposes readiness from registered probes. It ties together iet-config (the ConfigSource passed to prepare) and iet-core results without any runtime dependency injection.
// crates/features/iet-runtime-tokio/tests/lifecycle.rs
use ;
use AppResult;
use TokioRuntime;
use Duration;
;
;
new
.configuration // impl iet_config::ConfigSource
.runtime
.inject
.run_until // drains, then returns
.await?;
- Empty or duplicate
Module::NAMEvalues failrun_untilwithapp.modulesbefore any worker is prepared. - If a later
preparefails, already-prepared workers are dropped, so theirDropimpls must release resources.
Core contract
This page is the crate reference. For the framework-wide runtime and trait model, read Architecture.
What it implements
- Defines the traits other crates implement:
Probe,Shutdown,Worker,Module,TaskSpawner,Workers,Modules,Runtime.
What's inside
Modules
src/health.rssrc/lib.rs
Public API
(root)
- trait
Shutdown
- trait
Worker
- trait
Module
- trait
TaskSpawner
- trait
Workers
- struct
Prepared - trait
Modules
- struct
Injected - trait
Runtime
- struct
Application pub fn new() -> Selfpub fn configuration<S: ConfigSource>(self, source: S) -> Application<S, R, M>pub fn runtime<T: Runtime>(self, runtime: T) -> Application<C, T, M>pub fn inject<T: Module>(mut self, module: T) -> Application<C, R, Injected<M, T>>
health
- trait
Probe— Boxing is confined to the heterogeneous dependency registry.
- enum
Status - struct
Check - struct
Registration - enum
Lifecycle - struct
Health - struct
Snapshot pub fn ready(&self, max_age: Duration) -> boolpub fn new() -> Selfpub fn register(&self, registration: Registration) -> iet_core::AppResult<()>— Registration is composition-owned and allowed only before startup completes.pub fn registrations(&self) -> Vec<Registration>pub fn publish(&self, checks: Vec<Check>)pub fn started(&self)pub fn draining(&self)pub fn snapshot(&self) -> Snapshot
Impl map
Default for HealthWorkers for ()Workers for Prepared<P, W>Modules for ()Modules for Injected<P, M>Default for Application
Depends on
Used by
In this repository
examples/htmx-starter
Source: crates/core/iet-app