11489 shaares
417 private links
417 private links
I’m currently building an app that pulls a ton of data from an external API. If you use Rust, you know the drill: you get a UserDTO from the API, but you want a User in your domain. This usually leads to writing the same From trait implementation over and over again.
What’s in the sandbox so far? I built a macro called FromDTO. Instead of manually mapping dozens of fields, I can just do this:
Note the serde create do that for JSON and other formats