[−][src]Trait shaku::Component
Components provide a service by implementing an interface. They may use other components as dependencies.
This trait is normally derived, but if the derive
feature is turned off
then it will need to be implemented manually.
Associated Types
type Interface: Interface + ?Sized
The trait/interface which this component implements
type Parameters: Default
The parameters this component requires. If none are required, use ()
.
Required methods
fn build(
context: &mut ModuleBuildContext<M>,
params: Self::Parameters
) -> Box<Self::Interface>
context: &mut ModuleBuildContext<M>,
params: Self::Parameters
) -> Box<Self::Interface>
Use the build context and parameters to create the component. Other
components can be resolved by adding a HasComponent
bound to the
M
generic, then calling M::resolve
.