aboutsummaryrefslogtreecommitdiff
path: root/macros/src/injectable/dummy.rs
blob: 3ace79897453ba167bdfcb2354a791ffa669a986 (plain)
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
53
54
55
56
57
58
use quote::quote;
use syn::{Generics, Type};

#[cfg(not(tarpaulin_include))]
pub fn expand_dummy_blocking_impl(
    generics: &Generics,
    self_type: &Type,
) -> proc_macro2::TokenStream
{
    quote! {
        impl #generics syrette::interfaces::injectable::Injectable<
            syrette::di_container::blocking::DIContainer,
        > for #self_type
        {
            fn resolve(
                _: &syrette::di_container::blocking::DIContainer,
                _: syrette::dependency_history::DependencyHistory
            ) -> Result<
                syrette::ptr::TransientPtr<Self>,
                syrette::errors::injectable::InjectableError>
            {
                unimplemented!();
            }
        }
    }
}

#[cfg(not(tarpaulin_include))]
#[cfg(feature = "async")]
pub fn expand_dummy_async_impl(
    generics: &Generics,
    self_type: &Type,
) -> proc_macro2::TokenStream
{
    quote! {
        impl #generics syrette::interfaces::async_injectable::AsyncInjectable<
            syrette::di_container::asynchronous::AsyncDIContainer,
        > for #self_type
        {
            fn resolve<'di_container, 'fut>(
                _: &'di_container syrette::di_container::asynchronous::AsyncDIContainer,
                _: syrette::dependency_history::DependencyHistory
            ) -> syrette::future::BoxFuture<
                'fut,
                Result<
                    syrette::ptr::TransientPtr<Self>,
                    syrette::errors::injectable::InjectableError
                >
            >
            where
                Self: Sized + 'fut,
                'di_container: 'fut
            {
                unimplemented!();
            }
        }
    }
}