Expand description
Lock-free DI engine + macro registration descriptors.
Two-phase lifecycle:
-
Boot.
DiContainerBuildercollectsProviderDescriptors emitted by#[Injectable]/#[Module]. It topologically sorts them byTypeIddependency edges, detects cycles deterministically, then invokes each provider’sbuildfunction in dependency order. The build function receives aResolverview of already-constructed singletons. -
Run. The container is wrapped in an
Arc<FrozenDiContainer>shared by the router, request contexts, gateways, and plugin tasks. Every read is a singleHashMap::get+ downcast, both inlined. Zero locks, zero heap allocations on the request path (Arc::cloneis an atomic bump). The container drops when the server stops — no per-launch leak.
Structs§
- DiContainer
Builder - Mutable builder used only during boot.
- Frozen
DiContainer - Immutable, lock-free DI container. Reads are O(1) and inlined.
- Module
Descriptor - Emitted by
#[Module]. Owns its providers, the controllers it exposes, and the imports it pulls in. Used to walk the module DAG at boot. - Param
Spec - Provider
Descriptor - One row in the dependency graph.
- Resolver
- Build-time resolver passed to each provider’s
buildfn. Returns the already-constructed dependency byTypeId. Panics if a dependency hasn’t been built yet — topological order guarantees this can’t happen for a well-formed graph. - Route
Descriptor - Route
Spec
Enums§
Traits§
- Module
- Implemented by every
#[Module]-annotated struct soApp::launch::<RootMod>can find the entry point without a runtime registry lookup.