aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/animals
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-07-27 19:10:30 +0200
committerHampusM <hampus@hampusmat.com>2022-07-31 12:17:51 +0200
commitf75a7d58135825c4f9094c1e10f36de4a952f455 (patch)
treebd8bae08591b7355407ee44002e0494bdd8d2268 /examples/basic/animals
parent3388f857b32cf1893d7b54582c8fd16e4965550b (diff)
feat: add injecting singletons into constructors
Diffstat (limited to 'examples/basic/animals')
-rw-r--r--examples/basic/animals/human.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/basic/animals/human.rs b/examples/basic/animals/human.rs
index 8e52b5b..d9b848b 100644
--- a/examples/basic/animals/human.rs
+++ b/examples/basic/animals/human.rs
@@ -1,5 +1,5 @@
use syrette::injectable;
-use syrette::ptr::TransientPtr;
+use syrette::ptr::{SingletonPtr, TransientPtr};
use crate::interfaces::cat::ICat;
use crate::interfaces::dog::IDog;
@@ -7,14 +7,14 @@ use crate::interfaces::human::IHuman;
pub struct Human
{
- dog: TransientPtr<dyn IDog>,
+ dog: SingletonPtr<dyn IDog>,
cat: TransientPtr<dyn ICat>,
}
#[injectable(IHuman)]
impl Human
{
- pub fn new(dog: TransientPtr<dyn IDog>, cat: TransientPtr<dyn ICat>) -> Self
+ pub fn new(dog: SingletonPtr<dyn IDog>, cat: TransientPtr<dyn ICat>) -> Self
{
Self { dog, cat }
}