use std::sync::Arc;
trait Factory<T> {
fn get(&self) -> T;
}
struct Container {}
pub struct BeanA {
pub bean_b: Arc<BeanB>,
}
impl Factory<Arc<BeanA>> for Container {
fn get(&self) -> Arc<BeanA> {
BeanA { bean_b: self.get() }.into()
}
}
pub struct BeanB {
}
impl Factory<Arc<BeanB>> for Container {
fn get(&self) -> Arc<BeanB> {
BeanB{
}
.into()
}
}
fn do_smt(_a: Arc<BeanA>, _b: Arc<BeanB>) {}
#[test]
fn start() {
let container = Container {};
do_smt(container.get(), container.get());
}