use syrette::ptr::TransientPtr; use syrette::AsyncDIContainer; use crate::animals::cat::Cat; use crate::animals::dog::Dog; use crate::animals::human::Human; use crate::food::Food; use crate::interfaces::cat::ICat; use crate::interfaces::dog::IDog; use crate::interfaces::food::{IFood, IFoodFactory}; use crate::interfaces::human::IHuman; pub async fn bootstrap() -> Result { let mut di_container = AsyncDIContainer::new(); di_container .bind::() .to::()? .in_singleton_scope() .await?; di_container.bind::().to_default_factory(&|_| { Box::new(|| { let cat: TransientPtr = TransientPtr::new(Cat::new()); cat }) })?; di_container.bind::().to::()?; di_container.bind::().to_factory(&|_| { Box::new(|| { let food: Box = Box::new(Food::new()); food }) })?; Ok(di_container) }