diff --git a/helpers/pagetop-macros/src/lib.rs b/helpers/pagetop-macros/src/lib.rs index 6937b0a9..062e9860 100644 --- a/helpers/pagetop-macros/src/lib.rs +++ b/helpers/pagetop-macros/src/lib.rs @@ -45,19 +45,32 @@ pub fn fn_with(_attr: TokenStream, item: TokenStream) -> TokenStream { }) .collect(); + let fn_with_name = fn_name.replace("alter_", "with_"); + #[rustfmt::skip] let fn_with = parse_str::(concat_string!(" - pub fn ", fn_name.replace("alter_", "with_"), "(mut self, ", args.join(", "), ") -> Self { + pub fn ", fn_with_name, "(mut self, ", args.join(", "), ") -> Self { self.", fn_name, "(", param.join(", "), "); self } ").as_str()).unwrap(); + #[rustfmt::skip] + let fn_alter_doc = concat_string!( + "

", + "Use ", + fn_with_name, + "(self, …) -> Self to apply the builder pattern.", + "

" + ); + let fn_alter = fn_item.into_token_stream(); let expanded = quote! { + #[doc(hidden)] #fn_with #[inline] + #[doc = #fn_alter_doc] #fn_alter }; expanded.into()