Struct runtime_injector_actix::Module[][src]

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

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.

For creating a module easily via a domain specific language, see define_module!.

Implementations

impl Module[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 insert_parameter(
    &mut self,
    key: &str,
    value: impl RequestParameter
) -> Option<Box<dyn RequestParameter + 'static, Global>>
[src]

Sets the of a value request parameter for requests made by the injector this module is added to. If a parameter has already been set to a value in this module, then that value is returned.

pub fn remove_parameter(
    &mut self,
    key: &str
) -> Option<Box<dyn RequestParameter + 'static, Global>>
[src]

Removes and returns the value of a parameter if it has been set.

Trait Implementations

impl Default for Module[src]

pub fn default() -> Module[src]

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

impl WithArg for Module[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

impl !RefUnwindSafe for Module

impl Send for Module

impl Sync for Module

impl Unpin for Module

impl !UnwindSafe for Module

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]