I've created a Rust macro which expands to a function declaration.
macro_rules! build_fn
{
($name:tt) => {
pub fn $name(&self) -> Result<i32, Box<dyn Error>>
{
// <implementation>
Ok(0)
}
};
}
Is it possible to expand this so the macro can take variable parameters?
e.g.
($name:tt, /*$variable_args ? */) => {
pub fn $name(&self, /*$variable_args ? */) -> Result<i32, Box<dyn Error>>
{
// ...
Ok(0)
}
};
}