diff options
author | HampusM <hampus@hampusmat.com> | 2022-07-22 13:25:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-07-22 13:25:45 +0200 |
commit | 4cb3884e24b3cba3347ff93475bbabd6fe18d2fa (patch) | |
tree | 2fa5e6d81de9dc39bd11d64797914e5d305d98e2 /src/provider.rs | |
parent | 157f38bc2287dcb9a8b21ef3d5e33c569dc5136e (diff) |
refactor: make factories an optional feature
Diffstat (limited to 'src/provider.rs')
-rw-r--r-- | src/provider.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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<dyn Injectable>), + #[allow(dead_code)] Factory(FactoryPtr<dyn AnyFactory>), } @@ -57,11 +58,13 @@ where } } +#[cfg(feature = "factory")] pub struct FactoryProvider { factory: FactoryPtr<dyn AnyFactory>, } +#[cfg(feature = "factory")] impl FactoryProvider { pub fn new(factory: FactoryPtr<dyn AnyFactory>) -> Self @@ -70,6 +73,7 @@ impl FactoryProvider } } +#[cfg(feature = "factory")] impl IProvider for FactoryProvider { fn provide( |