serde integration, or custom proc macro for function arguments
Code like this is ugly, and similar code will exist in lots of places
https://github.com/pydantic/monty/blob/3759c96394659e86c78c64126368b59752337e26/crates/monty/src/types/datetime.rs#L183
We should support parsing args/kwargs into a struct using `serde::Deserialize` if it can support all forms of arguments, or a custom procedural macro if it can't.
So you would do something like
```rs
#[derive(serde::Deserialize)]
struct FunctionArgs {
#[args_kwargs]
a: i64,
#[kwarg_only]
b: String,
}
```
2 条评论