Trait dill::Builder

source ·
pub trait Builder: Send + Sync {
    // Required methods
    fn instance_type_id(&self) -> TypeId;
    fn instance_type_name(&self) -> &'static str;
    fn interfaces(&self) -> Vec<InterfaceDesc>;
    fn get(
        &self,
        cat: &Catalog
    ) -> Result<Arc<dyn Any + Send + Sync>, InjectionError>;
    fn check(&self, cat: &Catalog) -> Result<(), ValidationError>;
}
Expand description

Builders are responsible for resolving dependencies and creating new instances of a certain type. Builders typically create new instances for every call, delegating the lifetime management to Scopes,

Required Methods§

source

fn instance_type_id(&self) -> TypeId

source

fn instance_type_name(&self) -> &'static str

source

fn interfaces(&self) -> Vec<InterfaceDesc>

source

fn get( &self, cat: &Catalog ) -> Result<Arc<dyn Any + Send + Sync>, InjectionError>

source

fn check(&self, cat: &Catalog) -> Result<(), ValidationError>

Implementations on Foreign Types§

source§

impl<Impl> Builder for Arc<Impl>where Impl: Send + Sync + 'static,

Arc can infinitely produce clones of itself and therefore is a builder

Implementors§

source§

impl<'a, Iface> Builder for TypecastBuilder<'a, Iface>where Iface: 'static + ?Sized,

source§

impl<Fct, Impl> Builder for Fctwhere Fct: Fn() -> Arc<Impl> + Send + Sync, Impl: Send + Sync + 'static,

Fn() -> Arc acts as a builder