How to merge Slotmaps
⚓ Rust 📅 2026-05-02 👤 surdeus 👁️ 3I am planning on using a Slotmap to store the edges of a graph and be able to maintain index based references to them in my nodes.
I currently have the connections stored in a Vec which has issues with index reuse and ABA problems, etc (hence slotmap).
My one problem with this approach, is that I currently use Serde to read in multiple TOML files that can each contain my main data struct.
I need to have just one instance of the struct, so I merge the instances during initial startup which works fine with Vecs and HashMaps but I am unclear how I would do that with SlotMaps.
I currently merge the HashMap's with a helper function that checks for duplicated keys and errors if it finds any.
Any thoughts?
1 post - 1 participant
🏷️ Rust_feed