Crate runtime_injector_actix[−][src]
Utility library for injecting dependencies into actix-web applications.
Modules
docs | Additional documentation modules. |
Macros
define_module | Defines a new module using a domain specific language. |
interface | Marks a trait as being an interface for many other types. This means that a request for the given trait can resolve to any of the types indicated by this macro invocation. |
Structs
ConstantProvider | A provider which returns a constant, predetermined value. Note that this is technically a singleton service in that it does not recreate the value each time it is requested. |
FallibleServiceFactory | A service factory that may fail during service creation with a custom error
type. During activation failure, an instance of
|
Injected | An injected request. Any request to the |
Injector | A runtime dependency injection container. This holds all the bindings between service types and their providers, as well as all the mappings from interfaces to their implementations (if they differ). |
InjectorBuilder | A builder for an |
InterfaceProvider | Provides a service as an implementation of an interface. See
|
Module | A collection of providers that can be added all at once to an
|
OwnedServicesIter | An iterator over all the implementations of an interface. Each service is activated on demand. |
RequestInfo | Information about an active request. |
ServiceInfo | Type information about a service. |
Services | A collection of all the providers for a particular interface. |
ServicesIter | An iterator over all the implementations of an interface. Each service is activated on demand. |
SingletonProvider | A service provider that only creates a single instance of the service. The service is created only during its first request. Any subsequent requests return service pointers to the same service. |
TransientProvider | A service provider that creates an instance of the service each time it is requested. This will never return two service pointers to the same instance of a service. |
Enums
InjectError | An error that has occurred during creation of a service. |
Traits
AsAny | Defines a conversion for a type into a |
Interface | Indicates that a type can resolve services. The most basic implementation
of this trait is that each sized service type can resolve itself. This is
done by requesting the exact implementation of itself from the injector.
However, the injector cannot provide exact implementations for dynamic
types ( |
InterfaceFor | Marker trait that indicates that a type is an interface for another type.
Each sized type is an interface for itself, and each |
IntoFallible | Defines a conversion into a fallible service factory. This trait is
automatically implemented for all service factories that return a
|
IntoSingleton | Defines a conversion into a singleton provider. This trait is automatically implemented for all service factories. |
IntoTransient | Defines a conversion into a transient provider. This trait is automatically implemented for all service factories. |
Provider | Weakly typed service provider. Given an injector, this will provide an
implementation of a service. This is automatically implemented for all
types that implement |
Request | A request to an injector. |
RequestParameter | A parameter for configuring requested services. |
Service | Implemented automatically on types that are capable of being a service. |
ServiceFactory | A factory for creating instances of a service. All functions of arity 12 or less are automatically service factories if the arguments to that function are valid service requests and the return value is a valid service type. |
TypedProvider | A strongly-typed service provider. Types which implement this provide
instances of a service type when requested. Examples of typed providers
include providers created from service factories or constant providers.
This should be preferred over |
Functions
constant | Create a provider from a constant value. While the service itself will never be exposed through a mutable reference, if it supports interior mutability, its fields still can be mutated. Since the provider created with this function doesn’t recreate the value each time it’s requested, state can be stored in this manner. |
Type Definitions
DynSvc | A reference-counted service pointer holding an instance of |
InjectResult | A result from attempting to inject dependencies into a service and construct an instance of it. |
OwnedDynSvc | An owned service pointer holding an instance of |
Svc | A reference-counted pointer holding a service. The pointer type is determined by the feature flags passed to this crate. |