This crate allows you to auto-generate macros to call functions and instantiate structs with default named arguments
Import the macro and use it on a function or struct like this
```rust
use opt_args::opt_args;
opt_args! {
fn function(a: i32, b: &str = "default", c: (u8,)?) -> (i32, &str, (u8,)) {
(a, b, c)
}
}
opt_args! {
#[derive(Debug, PartialEq, Eq)]
struct Struct {
x: i32,
y: i32 = 1,
z: i32?,
other: Option>?,
}
}
```
To auto-generate macros that can be used like this
```rust
fn main() {
assert_eq!(
function!(1, b = "not the default"),
(1, "not the default", (0,))
);
assert_eq!(
Struct!(4, z = 5),
Struct {
x: 4,
y: 1,
z: 5,
other: None
}
);
}
```
Full documentation [here](https://docs.rs/opt_args/latest/opt_args/)