Add comon docs

This commit is contained in:
Joel Wachsler 2022-07-12 12:20:05 +00:00
parent 64803a2d16
commit 95104b653b

View File

@ -9,10 +9,8 @@ pub fn create_method_without_params(
method_name: proc_macro2::Ident,
url: &str,
) -> (proc_macro2::TokenStream, Option<proc_macro2::TokenStream>) {
match create_return_type(group, method) {
let res = match create_return_type(group, method) {
Some((return_type_name, return_type)) => (
util::add_docs(
&method.description,
quote! {
pub async fn #method_name(&self) -> Result<#return_type_name> {
let res = self.auth
@ -25,12 +23,9 @@ pub fn create_method_without_params(
Ok(res)
}
},
),
Some(return_type),
),
None => (
util::add_docs(
&method.description,
quote! {
pub async fn #method_name(&self) -> Result<String> {
let res = self.auth
@ -43,8 +38,10 @@ pub fn create_method_without_params(
Ok(res)
}
},
), // assume that all methods without a return type returns a string
// assume that all methods without a return type returns a string
None,
),
}
};
(util::add_docs(&method.description, res.0), res.1)
}