Open Sytten opened 3 months ago
I do like the idea but I don't think it should be an attribute macro. I would think making it a drive macro, like #[derive(FromJs)]
would be more idiomatic.
Any preference on a pure data object vs class based?
The class one conflicts with the existing class macro.
When you currently tag a class with the class attribute it will also implement FromJs. So a class with #[derive(FromJs)]
and #[class]
will cause an error for conflicting FromJs implementations.
I had this idea since I often use "data objects" to get multiple inputs in a JS function.
Given:
This would automatically implements
An alternative to also allow
new FindingSpec()
would be:Which would implement:
Happy to implement it @DelSkayn if you like the idea!