lasantosr/model-mapper
A powerful Rust macro to generate boilerplate-free declarations of From, Into, TryFrom, and TryInto traits for
Derive macro to map between different types
- Rust100.0%
1 Review
just did a deep dive on this before deciding whether to add it to a project. read through the source, traced the macro output by hand, went through all the examples. the nested container hints are the standout feature. opt(iter(opt)) mapping Option<Vec<Option<i32>>> to Option<Vec<Option<i64>>> in one annotation is genuinely useful and nothing else i found handles it as cleanly. the custom function escape hatch is well thought out too. when From can't express what you need, it generates a named method instead of trying to force a trait impl. that's the right instinct. two things gave me pause. TryFrom is hardcoded to anyhow::Error with no way to configure it, which is a real constraint if your codebase uses a different error type. and there's no actual test suite, just example files with asserts in main(). for a proc-macro that generates code invisibly, i'd want more coverage before fully trusting it. going to try it on a smaller layer first and see how it holds up.
