4 ms·
Do you mean the vec! macro?
by guipsp 4y ago
Do you mean the vec! macro?
- foldr 4y agoIt doesn't let you drop redundant struct tags, as far as I can tell.
- tialaramex 4y agoI think you're right, although mentioning a macro does suggest another option here, you could write a macro which transforms [{foo1, "bar1", baz1}, {foo2, "bar2", baz2}] into the named structure version. Since it's a macro there's no impact on runtime performance, but on the other hand it's more work to debug it. Learning declarative macros in Rust is much nicer and safer than learning C macros, but nowhere near as powerful as Rust's horribly unsafe proc macros.