3 releases

0.1.2 Jan 24, 2022
0.1.1 Jan 24, 2022
0.1.0 Jan 24, 2022

#58 in #ioc

Custom license

7KB
104 lines

ioc

rust new ioc

#[autowired] static defsingle: Option = None;

// 展开 // macro_rules! defsingle { // () => { // single_get!( "defsingle", EntityObj) // }; // } //这里是注入,后面还需要撸全局扫描注册组件,写法应该几乎一致,同样可用的内容还有这几个crate singlemap,iocmap,aop,extends-rs

#[test] fn test_one() { single_add!( "defsingle", Box::new(EntityObj { key: "hhhhh".to_string() }) ); println!("注入后获取值 :{:?}", defsingle!().key); }

Dependencies

~4.5–9.5MB
~105K SLoC