aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/injectable.rs
blob: 24032a6f813935c3c83e5f38f308f2470bc67e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::errors::injectable::ResolveError;
use crate::libs::intertrait::CastFrom;
use crate::ptr::InterfacePtr;
use crate::DIContainer;

pub trait Injectable: CastFrom
{
    /// Resolves the dependencies of the injectable.
    ///
    /// # Errors
    /// Will return `Err` if resolving the dependencies fails.
    fn resolve(
        di_container: &DIContainer,
    ) -> error_stack::Result<InterfacePtr<Self>, ResolveError>
    where
        Self: Sized;
}