Crate runtime_injector_actix[][src]

Expand description

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

Arg

Allows custom pre-defined values to be passed as arguments to services.

ConditionalProvider

A TypedProvider which conditionally provides its service. If the condition is not met, then the provider is skipped during resolution.

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.

Factory

Lazy request factory allowing requests to be made outside of service creation.

FallibleServiceFactory

A service factory that may fail during service creation with a custom error type. During activation failure, an instance of InjectError::ActivationFailed is returned as an error.

Injected

An injected request. Any request to the Injector can be injected by wrapping it in this type and providing it as a parameter to your request handler.

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 Injector.

InterfaceProvider

Provides a service as an implementation of an interface. See TypedProvider::with_interface() for more information.

Module

A collection of providers that can be added all at once to an InjectorBuilder. Modules can be used to group together related services and configure the injector in pieces rather than all at once.

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

ArgRequestError

An error occurred while injecting an instance of Arg<T>.

InjectError

An error that has occurred during creation of a service.

Traits

AsAny

Defines a conversion for a type into an dyn Any trait object.

Interface

Indicates functionality that can be implemented.

InterfaceFor

Marker trait that indicates that a type is an interface for another type.

IntoFallible

Defines a conversion into a fallible service factory. This trait is automatically implemented for all service factories that return a Result<T, E> with an error type that implements Error and Service.

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.

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.

WithArg

Allows defining pre-defined arguments to services.

WithCondition

Defines a conversion into a conditional provider. This trait is automatically implemented for all types that implement TypedProvider.

Functions

constant

Create a provider from a constant value.

Type Definitions

DynSvc

A reference-counted service pointer holding an instance of dyn Any.

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 dyn Any.

Svc

A reference-counted pointer holding a service. The pointer type is determined by the feature flags passed to this crate.