Skip to content

Commit

Permalink
Add ability to set function name on php_function macro
Browse files Browse the repository at this point in the history
This is much the same as `php_class(name="ABC")`
  • Loading branch information
joehoyle committed Sep 30, 2022
1 parent 199962c commit 18ede97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/macros/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct AttrArgs {
optional: Option<String>,
ignore_module: bool,
defaults: HashMap<String, Lit>,
name: Option<String>,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 18ede97

Please sign in to comment.