HampusMat/Syrette

Implement Injectable & AsyncInjectable for types implementing Default

HampusMat opened this issue · 1 comments

The Injectable and AsyncInjectable traits can be implemented for all types which implement the Default trait.

This could look something like this:

impl<T: Default, DIContainerT> Injectable<DIContainerT> for T
{
    fn resolve(
        _: &DIContainerT,
        _: DependencyHistory,
    ) -> Result<TransientPtr<Self>, InjectableError>
    {
        Ok(TransientPtr::new(Self::default()))
    }
}

Completed with e0d3991