aboutsummaryrefslogtreecommitdiff
path: root/macros/src/injectable/dummy.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-09-27 20:22:46 +0200
committerHampusM <hampus@hampusmat.com>2023-09-27 20:22:46 +0200
commit6533246020c9dcc1acfc02b1e5ed74fbbce4ea1f (patch)
tree5a852f3cd7816b46d9119362b42568d21f207bb5 /macros/src/injectable/dummy.rs
parent6a2c4025080776a386ab6dcd074fd05ae7319f9c (diff)
fix: set injectable macro dummies directly after parsing input
Diffstat (limited to 'macros/src/injectable/dummy.rs')
-rw-r--r--macros/src/injectable/dummy.rs58
1 files changed, 58 insertions, 0 deletions
diff --git a/macros/src/injectable/dummy.rs b/macros/src/injectable/dummy.rs
new file mode 100644
index 0000000..3ace798
--- /dev/null
+++ b/macros/src/injectable/dummy.rs
@@ -0,0 +1,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!();
+ }
+ }
+ }
+}