macro_rules! extract_macro_unnamed_args { ($db:expr, $syntax:expr, $n:expr, $pattern:pat) => { ... }; }
Expand description
Macro to extract unnamed arguments of an inline macro.
Gets the expected number of unnamed arguments, and the pattern for the allowed bracket types, and returns a fixed size array with the argument expressions.
Example usage (2 arguments, allowing ()
or {}
brackets):
let [arg1, arg2] = extract_macro_unnamed_args!(
db,
syntax,
2,
ast::WrappedArgList::ParenthesizedArgList() | ast::WrappedArgList::BracedArgList()
);