aboutsummaryrefslogtreecommitdiff
path: root/example/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-07-16 14:24:00 +0200
committerHampusM <hampus@hampusmat.com>2022-07-16 14:24:35 +0200
commite906a0fc5922776b8ecd17e3100b24fc44cedf19 (patch)
treec161a14558e3d0a3a6ede45ca8fa5dac6fac3fad /example/src
parent05be92b334af1beab3e7a3f2ee7626eb26c47e22 (diff)
refactor: use common pointer type aliases
Diffstat (limited to 'example/src')
-rw-r--r--example/src/main.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/example/src/main.rs b/example/src/main.rs
index 28f29b4..1f4ddb6 100644
--- a/example/src/main.rs
+++ b/example/src/main.rs
@@ -1,9 +1,7 @@
-use std::rc::Rc;
-
use syrette::errors::di_container::DIContainerError;
-use syrette::factory;
use syrette::interfaces::factory::IFactory;
-use syrette::{injectable, DIContainer};
+use syrette::ptr::{FactoryPtr, InterfacePtr};
+use syrette::{factory, injectable, DIContainer};
trait IDog
{
@@ -91,15 +89,19 @@ trait IHuman
struct Human
{
- _dog: Box<dyn IDog>,
- _cat: Box<dyn ICat>,
- _cow_factory: Rc<CowFactory>,
+ _dog: InterfacePtr<dyn IDog>,
+ _cat: InterfacePtr<dyn ICat>,
+ _cow_factory: FactoryPtr<CowFactory>,
}
#[injectable(IHuman)]
impl Human
{
- fn new(dog: Box<dyn IDog>, cat: Box<dyn ICat>, cow_factory: Rc<CowFactory>) -> Self
+ fn new(
+ dog: InterfacePtr<dyn IDog>,
+ cat: InterfacePtr<dyn ICat>,
+ cow_factory: FactoryPtr<CowFactory>,
+ ) -> Self
{
Self {
_dog: dog,