From 494d905bcbc50b536de892ecb3fa285dc6b8a727 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 24 Oct 2022 21:53:14 +0200 Subject: refactor: rename DI container binding map to DI container storage --- src/di_container/blocking/mod.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/di_container/blocking') diff --git a/src/di_container/blocking/mod.rs b/src/di_container/blocking/mod.rs index 3b9c16e..bf77aba 100644 --- a/src/di_container/blocking/mod.rs +++ b/src/di_container/blocking/mod.rs @@ -54,7 +54,7 @@ use std::any::type_name; use std::cell::RefCell; use std::rc::Rc; -use crate::di_container::binding_map::DIContainerBindingMap; +use crate::di_container::binding_storage::DIContainerBindingStorage; use crate::di_container::blocking::binding::builder::BindingBuilder; use crate::errors::di_container::DIContainerError; use crate::libs::intertrait::cast::{CastBox, CastRc}; @@ -110,7 +110,7 @@ pub trait IDIContainer: Sized + 'static + details::DIContainerInternals /// Blocking dependency injection container. pub struct DIContainer { - bindings: RefCell>>, + binding_storage: RefCell>>, } impl DIContainer @@ -120,7 +120,7 @@ impl DIContainer pub fn new() -> Rc { Rc::new(Self { - bindings: RefCell::new(DIContainerBindingMap::new()), + binding_storage: RefCell::new(DIContainerBindingStorage::new()), }) } } @@ -174,7 +174,7 @@ impl details::DIContainerInternals for DIContainer where Interface: ?Sized + 'static, { - self.bindings.borrow().has::(name) + self.binding_storage.borrow().has::(name) } fn set_binding( @@ -184,7 +184,9 @@ impl details::DIContainerInternals for DIContainer ) where Interface: 'static + ?Sized, { - self.bindings.borrow_mut().set::(name, provider); + self.binding_storage + .borrow_mut() + .set::(name, provider); } fn remove_binding( @@ -194,7 +196,7 @@ impl details::DIContainerInternals for DIContainer where Interface: 'static + ?Sized, { - self.bindings.borrow_mut().remove::(name) + self.binding_storage.borrow_mut().remove::(name) } } @@ -265,7 +267,7 @@ impl DIContainer where Interface: 'static + ?Sized, { - self.bindings + self.binding_storage .borrow() .get::(name) .map_or_else( @@ -353,7 +355,7 @@ mod tests }); di_container - .bindings + .binding_storage .borrow_mut() .set::(None, Box::new(mock_provider)); @@ -391,7 +393,7 @@ mod tests }); di_container - .bindings + .binding_storage .borrow_mut() .set::(Some("special"), Box::new(mock_provider)); @@ -431,7 +433,7 @@ mod tests .returning_st(move |_, _| Ok(Providable::Singleton(singleton.clone()))); di_container - .bindings + .binding_storage .borrow_mut() .set::(None, Box::new(mock_provider)); @@ -476,7 +478,7 @@ mod tests .returning_st(move |_, _| Ok(Providable::Singleton(singleton.clone()))); di_container - .bindings + .binding_storage .borrow_mut() .set::(Some("cool"), Box::new(mock_provider)); @@ -583,7 +585,7 @@ mod tests }); di_container - .bindings + .binding_storage .borrow_mut() .set::(None, Box::new(mock_provider)); @@ -680,7 +682,7 @@ mod tests }); di_container - .bindings + .binding_storage .borrow_mut() .set::(Some("special"), Box::new(mock_provider)); -- cgit v1.2.3-18-g5258