#[doc_params]Expand description
Generates documentation for a function’s parameters.
This macro analyzes the function signature and generates a documentation comment list based on the provided descriptions. It also handles curried return types.
§Syntax
ⓘ
#[doc_params(
"Description for first parameter",
("overridden_name", "Description for second parameter"),
...
)]
pub fn function_name(params) -> impl Fn(...) { ... }§Parameters
Descriptions: A comma-separated list. Each entry can be either a string literal or a tuple of two string literals(Name, Description).
§Generates
A list of documentation comments, one for each parameter, prepended to the function definition.
§Examples
ⓘ
// Invocation
#[doc_params(
"The first input value.",
("y", "The second input value.")
)]
pub fn foo(x: i32) -> impl Fn(i32) -> i32 { ... }
// Expanded code
/// * `x`: The first input value.
/// * `y`: The second input value.
pub fn foo(x: i32) -> impl Fn(i32) -> i32 { ... }§Constraints
- The number of arguments must exactly match the number of function parameters
(excluding
selfbut including parameters from curried return types).