1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
use proc_macro2::TokenStream;
use quote::quote;
use crate::fn_trait::FnTrait;
pub fn build_declare_factory_interfaces(
factory_interface: &FnTrait,
is_threadsafe: bool,
) -> TokenStream
{
if is_threadsafe {
quote! {
syrette::declare_interface!(
syrette::castable_factory::threadsafe::ThreadsafeCastableFactory<
(std::sync::Arc<syrette::async_di_container::AsyncDIContainer>,),
#factory_interface
> -> syrette::interfaces::factory::IFactory<
(std::sync::Arc<syrette::async_di_container::AsyncDIContainer>,),
#factory_interface
>,
async = true
);
syrette::declare_interface!(
syrette::castable_factory::threadsafe::ThreadsafeCastableFactory<
(std::sync::Arc<syrette::async_di_container::AsyncDIContainer>,),
#factory_interface
> -> syrette::interfaces::any_factory::AnyThreadsafeFactory,
async = true
);
}
} else {
quote! {
syrette::declare_interface!(
syrette::castable_factory::blocking::CastableFactory<
(std::rc::Rc<syrette::di_container::DIContainer>,),
#factory_interface
> -> syrette::interfaces::factory::IFactory<
(std::rc::Rc<syrette::di_container::DIContainer>,),
#factory_interface
>
);
syrette::declare_interface!(
syrette::castable_factory::blocking::CastableFactory<
(std::rc::Rc<syrette::di_container::DIContainer>,),
#factory_interface
> -> syrette::interfaces::any_factory::AnyFactory
);
}
}
}
|