Merge pull request #153 from joehoyle/add-name-function-macro

Add ability to set function name on php_function macro
This commit is contained in:
Tobias Bengtsson 2022-09-30 13:04:22 +02:00 committed by GitHub
commit 73902ef017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ pub struct AttrArgs {
optional: Option<String>,
ignore_module: bool,
defaults: HashMap<String, Lit>,
name: Option<String>,
}
#[derive(Debug, Clone)]
@ -93,7 +94,7 @@ pub fn parser(args: AttributeArgs, input: ItemFn) -> Result<(TokenStream, Functi
}
let function = Function {
name: ident.to_string(),
name: attr_args.name.unwrap_or_else(|| ident.to_string()),
docs: get_docs(&input.attrs),
ident: internal_ident.to_string(),
args,