Component

Trait Component 

Source
pub trait Component: ComponentDowncast<Self> + Sized {
    // Required method
    fn create(
        instance_provider: &mut dyn ComponentInstanceProvider,
    ) -> Result<Self, ComponentInstanceProviderError>;
}
Expand description

Base trait for components for dependency injection.

Components might depend on other components, which forms the basis for dependency injection. To make the system work, your component instances must be wrapped in a ComponentInstancePtr. Please see the module-level documentation for more information.

Required Methods§

Source

fn create( instance_provider: &mut dyn ComponentInstanceProvider, ) -> Result<Self, ComponentInstanceProviderError>

Creates an instance of this component using dependencies from given ComponentInstanceProvider.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§