From b4718494e3a1759286caca1dd34c01db6c2f1214 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 4 Aug 2023 22:03:30 +0200 Subject: refactor!: remove SomeThreadsafePtr & move variants to SomePtr BREAKING CHANGE: SomeThreadsafePtr has been removed and it's variants have been moved to SomePtr --- macros/src/injectable/implementation.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'macros') diff --git a/macros/src/injectable/implementation.rs b/macros/src/injectable/implementation.rs index 0ea623c..575b5c4 100644 --- a/macros/src/injectable/implementation.rs +++ b/macros/src/injectable/implementation.rs @@ -223,6 +223,10 @@ impl InjectableImpl let self_type = &self.self_type; let constructor = &self.constructor_method.sig.ident; + let dependency_idents = (0..get_dep_method_calls.len()) + .map(|index| format_ident!("dependency_{index}")) + .collect::>(); + quote! { #maybe_doc_hidden impl #generics syrette::interfaces::async_injectable::AsyncInjectable< @@ -256,8 +260,14 @@ impl InjectableImpl #maybe_prevent_circular_deps + // Dependencies can't be passed directly to the constructor + // because the Rust compiler becomes sad about SomePtr having + // a variant with a Rc inside of it and .await being called even + // when the Rc variant isn't even being created + #(let #dependency_idents = #get_dep_method_calls;)* + Ok(syrette::ptr::TransientPtr::new(Self::#constructor( - #(#get_dep_method_calls),* + #(#dependency_idents),* ))) }) } -- cgit v1.2.3-18-g5258