From 4cb3884e24b3cba3347ff93475bbabd6fe18d2fa Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 22 Jul 2022 13:25:45 +0200 Subject: refactor: make factories an optional feature --- src/provider.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/provider.rs') diff --git a/src/provider.rs b/src/provider.rs index 3b7e04c..bd17474 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -1,8 +1,8 @@ #![allow(clippy::module_name_repetitions)] use std::marker::PhantomData; -use crate::castable_factory::AnyFactory; use crate::errors::injectable::ResolveError; +use crate::interfaces::any_factory::AnyFactory; use crate::interfaces::injectable::Injectable; use crate::ptr::{FactoryPtr, InterfacePtr}; use crate::DIContainer; @@ -12,6 +12,7 @@ extern crate error_stack; pub enum Providable { Injectable(InterfacePtr), + #[allow(dead_code)] Factory(FactoryPtr), } @@ -57,11 +58,13 @@ where } } +#[cfg(feature = "factory")] pub struct FactoryProvider { factory: FactoryPtr, } +#[cfg(feature = "factory")] impl FactoryProvider { pub fn new(factory: FactoryPtr) -> Self @@ -70,6 +73,7 @@ impl FactoryProvider } } +#[cfg(feature = "factory")] impl IProvider for FactoryProvider { fn provide( -- cgit v1.2.3-18-g5258