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 --- examples/basic/animals/human.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'examples/basic/animals/human.rs') diff --git a/examples/basic/animals/human.rs b/examples/basic/animals/human.rs index 5bd2f8f..00574a3 100644 --- a/examples/basic/animals/human.rs +++ b/examples/basic/animals/human.rs @@ -1,8 +1,7 @@ use syrette::injectable; -use syrette::ptr::{FactoryPtr, InterfacePtr}; +use syrette::ptr::InterfacePtr; use crate::interfaces::cat::ICat; -use crate::interfaces::cow::{CowFactory, ICow}; use crate::interfaces::dog::IDog; use crate::interfaces::human::IHuman; @@ -10,23 +9,14 @@ pub struct Human { dog: InterfacePtr, cat: InterfacePtr, - cow_factory: FactoryPtr, } #[injectable(IHuman)] impl Human { - pub fn new( - dog: InterfacePtr, - cat: InterfacePtr, - cow_factory: FactoryPtr, - ) -> Self + pub fn new(dog: InterfacePtr, cat: InterfacePtr) -> Self { - Self { - dog, - cat, - cow_factory, - } + Self { dog, cat } } } @@ -41,9 +31,5 @@ impl IHuman for Human println!("Hi kitty!"); self.cat.meow(); - - let cow: Box = (self.cow_factory)(3); - - cow.moo(); } } -- cgit v1.2.3-18-g5258