Skip to main content

Crate injectable_rs_runtime

Crate injectable_rs_runtime 

Source
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-injected
  • Provider — async trait for constructing values
  • DynProvider — closure-based provider for external types
  • ProviderRegistry — registry for dynamically-registered providers
  • Extract — Axum-inspired extractor trait
  • Inject — wrapper providing shared (Arc) access to dependencies
  • ResolveContext — the resolution context holding singleton storage
  • SingletonStore — trait for generated typed singleton storage

Structs§

DynProvider
A dynamic, closure-based provider for types that cannot derive Injectable.
EmptySingletonStore
A minimal empty singleton store for containers with no singletons.
FactoryCtx
Scope-safe resolution context for factory closures.
Inject
A wrapper around Arc<T> that can be extracted from a ResolveContext.
InjectableArcFactory
An entry submitted to the inventory by #[injectable_impl] and #[derive(Injectable)] macros, allowing Injectable types to be resolved via the same try_resolve_external path as DynProvider-registered types.
InjectableHooksEntry
An inventory entry that carries lifecycle hook function pointers for one Injectable type.
ProviderRegistry
A registry of dynamically-registered providers for external types.
RequestScoped
One instance per request/task (reserved for future use).
ResolveContext
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§

InjectableError
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.
PostConstruct
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.
SingletonStore
Trait for generated typed singleton stores.

Type Aliases§

HookResult
A specialized result type for lifecycle hooks.
InjectableProvideFnPtr
Type alias for the type-erased provide function pointer stored in inventory-submitted InjectableArcFactory entries.
InjectableResult
A specialized Result type for injectable operations.
MakePreDestructFnPtr
Function pointer that receives a type-erased Arc<T> and returns an Arc<dyn PreDestruct> adapter suitable for registering with the context.
PostConstructFnPtr
Function pointer that receives a type-erased Arc<T> and calls the #[injectable(post_construct)] hook(s) on the instance.