Trait shaku::Component[][src]

pub trait Component<M: Module>: Interface {
    type Interface: Interface + ?Sized;
    type Parameters: Default + Send;
    fn build(
        context: &mut ModuleBuildContext<M>,
        params: Self::Parameters
    ) -> Box<Self::Interface>; }

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[src]

The trait/interface which this component implements

type Parameters: Default + Send[src]

The parameters this component requires. If none are required, use ().

Loading content...

Required methods

fn build(
    context: &mut ModuleBuildContext<M>,
    params: Self::Parameters
) -> Box<Self::Interface>
[src]

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::build_component.

Loading content...

Implementors

Loading content...