Trait runtime_injector_actix::Provider [−][src]
pub trait Provider: Service { fn result(&self) -> ServiceInfo; fn provide(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>; fn provide_owned(
&mut self,
_injector: &Injector,
_request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError> { ... } }
Expand description
Weakly typed service provider.
Given an injector, this can provide an instance of a service. This is
automatically implemented for all types that implement TypedProvider
,
and TypedProvider
should be preferred if possible for custom service
providers to allow for stronger type checking.
Required methods
fn result(&self) -> ServiceInfo
[src]
Expand description
The ServiceInfo
which describes the type returned by this provider.
fn provide(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>
[src]
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>
Expand description
Provides an instance of the service.
Provided methods
fn provide_owned(
&mut self,
_injector: &Injector,
_request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError>
[src]
&mut self,
_injector: &Injector,
_request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError>
Expand description
Provides an owned instance of the service.
Implementors
impl<I, P> Provider for InterfaceProvider<I, P> where
P: TypedProvider,
I: InterfaceFor<<P as TypedProvider>::Result> + ?Sized,
[src]
impl<I, P> Provider for InterfaceProvider<I, P> where
P: TypedProvider,
I: InterfaceFor<<P as TypedProvider>::Result> + ?Sized,
[src]pub fn result(&self) -> ServiceInfo
[src]
pub fn provide(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>
[src]
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>
pub fn provide_owned(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError>
[src]
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError>
impl<T> Provider for T where
T: TypedProvider,
[src]
impl<T> Provider for T where
T: TypedProvider,
[src]pub fn result(&self) -> ServiceInfo
[src]
pub fn provide(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>
[src]
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Arc<dyn Any + 'static + Sync + Send>, InjectError>
pub fn provide_owned(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError>
[src]
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> Result<Box<dyn Any + 'static + Sync + Send, Global>, InjectError>