From d4078c84a83d121a4e3492955359cedb3b404476 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 25 Aug 2022 20:46:14 +0200 Subject: refactor!: limit FactoryPtr & AnyFactory to the factory feature BREAKING CHANGE: FactoryPtr has been limited to the factory feature --- src/provider.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/provider.rs') 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), Singleton(SingletonPtr), - #[allow(dead_code)] - Factory(FactoryPtr), + #[cfg(feature = "factory")] + Factory(crate::ptr::FactoryPtr), } pub trait IProvider @@ -95,13 +94,15 @@ where #[cfg(feature = "factory")] pub struct FactoryProvider { - factory: FactoryPtr, + factory: crate::ptr::FactoryPtr, } #[cfg(feature = "factory")] impl FactoryProvider { - pub fn new(factory: FactoryPtr) -> Self + pub fn new( + factory: crate::ptr::FactoryPtr, + ) -> Self { Self { factory } } -- cgit v1.2.3-18-g5258