Expand description
Runtime types and core traits for the injectable framework.
This crate provides the foundational abstractions:
Injectable— marker trait for types that can be dependency-injectedProvider— async trait for constructing valuesDynProvider— closure-based provider for external typesProviderRegistry— registry for dynamically-registered providersExtract— Axum-inspired extractor traitInject— wrapper providing shared (Arc) access to dependenciesResolveContext— the resolution context holding singleton storageSingletonStore— trait for generated typed singleton storage
Structs§
- DynProvider
- A dynamic, closure-based provider for types that cannot derive
Injectable. - Empty
Singleton Store - A minimal empty singleton store for containers with no singletons.
- Factory
Ctx - Scope-safe resolution context for factory closures.
- Inject
- A wrapper around
Arc<T>that can be extracted from aResolveContext. - Injectable
ArcFactory - An entry submitted to the inventory by
#[injectable_impl]and#[derive(Injectable)]macros, allowing Injectable types to be resolved via the sametry_resolve_externalpath as DynProvider-registered types. - Injectable
Hooks Entry - An inventory entry that carries lifecycle hook function pointers for one Injectable type.
- Provider
Registry - A registry of dynamically-registered providers for external types.
- Request
Scoped - One instance per request/task (reserved for future use).
- Resolve
Context - The resolution context passed through provider chains.
- Singleton
- One instance per container (the default scope).
- Transient
- A fresh instance is created on every resolution.
Enums§
- Injectable
Error - Errors that can occur during dependency resolution.
Constants§
- DEFAULT_
TOKEN - The default (unnamed) provider token.
Traits§
- Extract
- Axum-inspired extractor trait for dependency resolution.
- Injectable
- The primary trait for types that can be dependency-injected.
- Post
Construct - Trait for post-construction lifecycle hooks.
- PreDestruct
- Trait for pre-destruction lifecycle hooks.
- Provider
- A provider that can asynchronously construct a value of type
T. - Singleton
Store - Trait for generated typed singleton stores.
Type Aliases§
- Hook
Result - A specialized result type for lifecycle hooks.
- Injectable
Provide FnPtr - Type alias for the type-erased provide function pointer stored in
inventory-submitted
InjectableArcFactoryentries. - Injectable
Result - A specialized
Resulttype for injectable operations. - Make
PreDestruct FnPtr - Function pointer that receives a type-erased
Arc<T>and returns anArc<dyn PreDestruct>adapter suitable for registering with the context. - Post
Construct FnPtr - Function pointer that receives a type-erased
Arc<T>and calls the#[injectable(post_construct)]hook(s) on the instance.