Hi there!
I've created a macro that allows me to track updates to a struct for auditing purposes. That's working well enough, but to allow storing the various data types I have an enum of every sort of data that could be held by any struct. The issue is that I have a lot of repetitive code for From<CustomStruct> for MyEnum
and was wondering if there's a common off-the-shelf crate before I go writing my own thing
Here's an example. As a summary here:
enum BaseTypes {
String(String),
I32(i32),
TypeA(MyTypeA),
TypeB(MyTypeB),
}
impl From<String> for BaseTypes {
fn from(value: String) -> Self {
BaseTypes::String(value)
}
}
// ... The impl above is duplicated for about ten data types so far and growing
I think what I'm looking for is a macro that will create a From<> impl for each member of the enum that can store a value. Any good crates before I go writing my own?