Struct runtime_injector::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]
impl Module
[src]pub fn provide<P: Provider>(&mut self, provider: P)
[src]
pub fn provide<P: Provider>(&mut self, provider: P)
[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>>
[src]
pub fn insert_parameter(
&mut self,
key: &str,
value: impl RequestParameter
) -> Option<Box<dyn RequestParameter>>
[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>>
[src]
pub fn remove_parameter(
&mut self,
key: &str
) -> Option<Box<dyn RequestParameter>>
[src]Removes and returns the value of a parameter if it has been set.