diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-25 20:46:14 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-27 14:29:42 +0200 |
commit | d4078c84a83d121a4e3492955359cedb3b404476 (patch) | |
tree | f31fef99fcee6ffd537b7d7adf7981851966feda /src/provider.rs | |
parent | 626e9e56c23863dce33ef211fa51e49cc5fb48e1 (diff) |
refactor!: limit FactoryPtr & AnyFactory to the factory feature
BREAKING CHANGE: FactoryPtr has been limited to the factory feature
Diffstat (limited to 'src/provider.rs')
-rw-r--r-- | src/provider.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/provider.rs b/src/provider.rs index ad94589..13674b9 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -2,9 +2,8 @@ use std::marker::PhantomData; use crate::errors::injectable::InjectableError; -use crate::interfaces::any_factory::AnyFactory; use crate::interfaces::injectable::Injectable; -use crate::ptr::{FactoryPtr, SingletonPtr, TransientPtr}; +use crate::ptr::{SingletonPtr, TransientPtr}; use crate::DIContainer; #[derive(strum_macros::Display, Debug)] @@ -12,8 +11,8 @@ pub enum Providable { Transient(TransientPtr<dyn Injectable>), Singleton(SingletonPtr<dyn Injectable>), - #[allow(dead_code)] - Factory(FactoryPtr<dyn AnyFactory>), + #[cfg(feature = "factory")] + Factory(crate::ptr::FactoryPtr<dyn crate::interfaces::any_factory::AnyFactory>), } pub trait IProvider @@ -95,13 +94,15 @@ where #[cfg(feature = "factory")] pub struct FactoryProvider { - factory: FactoryPtr<dyn AnyFactory>, + factory: crate::ptr::FactoryPtr<dyn crate::interfaces::any_factory::AnyFactory>, } #[cfg(feature = "factory")] impl FactoryProvider { - pub fn new(factory: FactoryPtr<dyn AnyFactory>) -> Self + pub fn new( + factory: crate::ptr::FactoryPtr<dyn crate::interfaces::any_factory::AnyFactory>, + ) -> Self { Self { factory } } |