Expand description
A small, explicit dependency-injection runtime for Axum applications.
Container owns application providers while ModuleGraph verifies module
boundaries before the application starts. The older Injector API is
retained for applications migrating from the first preview release.
Re-exports§
pub use middleware::Application;
Modules§
- middleware
- HTTP middleware and application pipeline composition. Ordered HTTP middleware for applications, controllers, and routes.
- prelude
- Common controller types and macros.
Structs§
- ApiOperation
- Route documentation collected by
#[routes]; this is metadata, not an OpenAPI schema. - ApiResponse
- Documentation attached to one declared controller response.
- Container
- Thread-safe provider container. Singleton values are cached for its lifetime.
- Container
Builder - Builds a validated
Container. - Documentation
Error - Invalid or conflicting route documentation discovered before serving traffic.
- Http
Error - Safe HTTP failure. Generated server middleware adds the standard error envelope.
- Injector
- Compatibility injector storing cloneable application values.
- Module
Definition - Declarative module metadata, used to validate imports and exports.
- Module
Graph - Validates module metadata and flattens modules into a container.
- Provider
Definition - A provider registration. Dependencies are metadata used for startup validation.
- Provider
Key - A type-safe key used to identify a provider.
- Request
Container - Per-request provider cache. Request-scoped values cannot escape this type.
- Validated
Json - JSON extractor used by generated
#[body]adapters to validate DTOs automatically. - Validated
Query - Query extractor used by generated
#[query]adapters to validate DTOs automatically.
Enums§
- Inject
Error - Errors discovered while constructing or validating an application.
- Scope
- The lifecycle of a provider instance.
Traits§
- Injectable
- Compatibility construction contract for applications using the original injector.
- Provider
- Types generated by
#[injectable]can register themselves with a container.
Functions§
- json_
schema - Generate a schema using the same Serde contract as the DTO or response entity.
- openapi_
document - Build an OpenAPI 3.1 document; reject duplicate paths, IDs, and schema names.
Type Aliases§
- Http
Status - HTTP status codes usable by controllers without importing Axum internals.
Attribute Macros§
- body
- Preserve this annotation for the owning route or module macro.
- controller
- Generate a controller router from method route attributes.
- delete
- Declare an HTTP DELETE handler.
- exception
- Preserve this annotation for the owning route or module macro.
- extension
- Preserve this annotation for the owning route or module macro.
- get
- Declare an HTTP GET handler.
- global
- Marks a module as globally visible. It is consumed by
#[module]. - guard
- Preserve this annotation for the owning route or module macro.
- head
- Declare an HTTP HEAD handler.
- header
- Preserve this annotation for the owning route or module macro.
- injectable
- Generate dependency-injection factories for a struct.
- interceptor
- Preserve this annotation for the owning route or module macro.
- middleware
- Declare ordered controller or route middleware under
#[controller]or#[routes]. - module
- Declare module providers, imports, and exported dependencies.
- on_
bootstrap - Preserve this annotation for the owning route or module macro.
- on_
module_ destroy - Preserve this annotation for the owning route or module macro.
- on_
module_ init - Preserve this annotation for the owning route or module macro.
- on_
shutdown - Preserve this annotation for the owning route or module macro.
- options
- Declare an HTTP OPTIONS handler.
- param
- Preserve this annotation for the owning route or module macro.
- patch
- Declare an HTTP PATCH handler.
- post
- Declare an HTTP POST handler.
- put
- Declare an HTTP PUT handler.
- query
- Preserve this annotation for the owning route or module macro.
- request
- Preserve this annotation for the owning route or module macro.
- routes
- Generate an Axum router for an inherent controller implementation.
- scope
- Selects the provider lifecycle used by
#[injectable](singleton,transient, orrequest). - state
- Preserve this annotation for the owning route or module macro.
- test_
module - Preserve this annotation for the owning route or module macro.
- validate
- Preserve this annotation for the owning route or module macro.
Derive Macros§
- Injectable
- Derive dependency-injection factories without changing the struct declaration.