From 3383faeaf8342cf4637b6d9a9dfba30b1684edca Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 31 Jul 2022 13:26:41 +0200 Subject: feat: add hide impl of Injectable from documentation This will make it so that by default the impl of Injectable is hidden from user code documentation. This commit also includes a flag for the injectable macro to disable the aforementioned feature --- macros/src/injectable_impl.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'macros/src/injectable_impl.rs') diff --git a/macros/src/injectable_impl.rs b/macros/src/injectable_impl.rs index f510407..227a8c6 100644 --- a/macros/src/injectable_impl.rs +++ b/macros/src/injectable_impl.rs @@ -38,7 +38,7 @@ impl Parse for InjectableImpl impl InjectableImpl { - pub fn expand(&self) -> proc_macro2::TokenStream + pub fn expand(&self, no_doc_hidden: bool) -> proc_macro2::TokenStream { let Self { dependency_types, @@ -51,9 +51,18 @@ impl InjectableImpl let get_dependencies = Self::_create_get_dependencies(dependency_types); + let maybe_doc_hidden = if no_doc_hidden { + quote! {} + } else { + quote! { + #[doc(hidden)] + } + }; + quote! { #original_impl + #maybe_doc_hidden impl #generics syrette::interfaces::injectable::Injectable for #self_type { fn resolve( #di_container_var: &syrette::DIContainer -- cgit v1.2.3-18-g5258