De-serialize struct, embed filepath it came from
⚓ Rust 📅 2025-09-07 👤 surdeus 👁️ 11I have several structs that I need to serialize and deserialize into/from TOML files.
Each TOML file can contain similar data (think data libraries), and they will all be combined into one master library data structure in the code.
I need to be able to track which data file each struct instance came from, so I can write them back to the correct file when saved (IE, can't just use a naive serialize implementation, which would dump everything into one file).
I should be able to do this with a wrapper function, and serde(skip) attribute on the filepath field, but was curious if there was a more elegant way to do this via Serde.
Thanks in advance!
1 post - 1 participant
🏷️ Rust_feed