[][src]Trait shaku::component::Component

pub trait Component: 'static {
    type Interface: Interface + ?Sized;
    fn dependencies() -> Vec<Dependency>;
fn build(
        build_context: &mut ContainerBuildContext,
        params: &mut ParameterMap
    ) -> Result<()>; }

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

Loading content...

Required methods

fn dependencies() -> Vec<Dependency>

The other components which this component depends on.

fn build(
    build_context: &mut ContainerBuildContext,
    params: &mut ParameterMap
) -> Result<()>

Use the build context and parameters to create the component. The created component must be inserted into the build context via ContainerBuildContext::insert.

Loading content...

Implementors

Loading content...