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%
Placement
Every place and its price$3
Nobody has bought this repo a place yet. Listing is free. Paid placement starts at $3, and $18 puts it at the top. You pay once: a place holds until another repo spends more, and then it moves down, never off. No subscription, no expiry, no refunds.
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.
Thanks for the review! TryFrom is now customizable, and I'm planning on adding more tests once I finish a pending refactor.
