Struct runtime_injector_actix::InjectorBuilder[][src]

pub struct InjectorBuilder { /* fields omitted */ }
Expand description

A builder for an Injector.

Implementations

impl InjectorBuilder[src]

pub fn provide<P>(&mut self, provider: P) where
    P: Provider
[src]

Assigns the provider for a service type. Multiple providers can be registered for a service.

pub fn add_provider(&mut self, provider: Box<dyn Provider + 'static, Global>)[src]

Adds a provider to the injector.

pub fn remove_providers(
    &mut self,
    service_info: ServiceInfo
) -> Option<Vec<Box<dyn Provider + 'static, Global>, Global>>
[src]

Removes all providers for a service type.

#[must_use]
pub fn root_info(&self) -> &RequestInfo
[src]

Borrows the root RequestInfo that will be used by calls to Injector::get().

#[must_use]
pub fn root_info_mut(&mut self) -> &mut RequestInfo
[src]

Mutably borrows the root RequestInfo that will be used by calls to Injector::get().

pub fn add_module(&mut self, module: Module)[src]

Adds all the providers registered in a module. This may cause multiple providers to be registered for the same service.

If any conflicting request parameters have been set before adding this module, they are overridden.

#[must_use]
pub fn build(self) -> Injector
[src]

Builds the injector.

Trait Implementations

impl Default for InjectorBuilder[src]

pub fn default() -> InjectorBuilder[src]

Returns the “default value” for a type. Read more

impl WithArg for InjectorBuilder[src]

pub fn with_arg<S, T>(
    &mut self,
    value: T
) -> Option<Box<dyn RequestParameter + 'static, Global>> where
    T: Service + AsAny + Clone,
    S: Service
[src]

Adds an argument for a service. See the docs for Arg<T>.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> AsAny for T where
    T: Any
[src]

pub fn as_any(&self) -> &(dyn Any + 'static)[src]

Converts self into a trait object.

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

Converts self into a mutable trait object.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T> Interface for T where
    T: Service
[src]

pub fn downcast(
    service: Arc<dyn Any + 'static + Sync + Send>
) -> Result<Arc<T>, InjectError>
[src]

Downcasts a dynamic service pointer into a service pointer of this interface type. Read more

pub fn downcast_owned(
    service: Box<dyn Any + 'static + Sync + Send, Global>
) -> Result<Box<T, Global>, InjectError>
[src]

Downcasts an owned dynamic service pointer into an owned service pointer of this interface type. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> InterfaceFor<T> for T where
    T: Service
[src]

impl<T> Service for T where
    T: Any + Send + Sync + ?Sized
[src]