Struct runtime_injector::TransientProvider [−][src]
pub struct TransientProvider<D, R, F> where
R: Service,
F: ServiceFactory<D, Result = R>, { /* fields omitted */ }
Expand description
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.
Implementations
impl<D, R, F> TransientProvider<D, R, F> where
R: Service,
F: ServiceFactory<D, Result = R>,
[src]
impl<D, R, F> TransientProvider<D, R, F> where
R: Service,
F: ServiceFactory<D, Result = R>,
[src]#[must_use]pub fn new(func: F) -> Self
[src]
#[must_use]pub fn new(func: F) -> Self
[src]Creates a new TransientProvider
using a service factory.
Trait Implementations
impl<D, R, F> From<F> for TransientProvider<D, R, F> where
R: Service,
F: ServiceFactory<D, Result = R>,
[src]
impl<D, R, F> From<F> for TransientProvider<D, R, F> where
R: Service,
F: ServiceFactory<D, Result = R>,
[src]impl<D, R, F> TypedProvider for TransientProvider<D, R, F> where
D: Service,
R: Service,
F: ServiceFactory<D, Result = R>,
[src]
impl<D, R, F> TypedProvider for TransientProvider<D, R, F> where
D: Service,
R: Service,
F: ServiceFactory<D, Result = R>,
[src]type Result = R
type Result = R
The type of service this can provide.
fn provide_typed(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> InjectResult<Svc<Self::Result>>
[src]
fn provide_typed(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> InjectResult<Svc<Self::Result>>
[src]fn provide_owned_typed(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> InjectResult<Box<Self::Result>>
[src]
fn provide_owned_typed(
&mut self,
injector: &Injector,
request_info: &RequestInfo
) -> InjectResult<Box<Self::Result>>
[src]Provides an owned instance of the service. Not all providers can provide an owned variant of the service. Read more
fn with_interface<I: ?Sized + InterfaceFor<Self::Result>>(
self
) -> InterfaceProvider<I, Self>
[src]
fn with_interface<I: ?Sized + InterfaceFor<Self::Result>>(
self
) -> InterfaceProvider<I, Self>
[src]Provides this service as an implementation of a particular interface. Rather than requesting this service with its concrete type, it can instead be requested by its interface type. Read more
Auto Trait Implementations
impl<D, R, F> RefUnwindSafe for TransientProvider<D, R, F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<D, R, F> Send for TransientProvider<D, R, F>
impl<D, R, F> Sync for TransientProvider<D, R, F>
impl<D, R, F> Unpin for TransientProvider<D, R, F> where
F: Unpin,
F: Unpin,
impl<D, R, F> UnwindSafe for TransientProvider<D, R, F> where
F: UnwindSafe,
F: UnwindSafe,