Expand description
Hacks to extract the version and index from a slotmap key, using serde.
This approach may fail in the future if slotmap
changes its serde output;
but that would probably break a bunch other tools that depend on slotmap
.
§Performance
This serde-based approach might look inefficient, but the compiler is smart:
it can inline all of the code and turn key_data_parts
into direct data lookups.
(Note that this performance property requires us to use opt-level = 2
for this crate,
in contrast with the rest of Arti, which currently prefers opt-level = "s"
.)
To conform that performance is likely acceptable, run
cargo asm slotmap_careful::key_data::key_data_parts
,
and confirm that the result would fit on a napkin.
Macros§
- shared_
no_ 🔒ops - Helper: Define the common members of
Ser
andSerU32
.
Structs§
- Failed 🔒
- An unexpected failure from serializing a key.
- Ser 🔒
- Serializer for slotmap::KeyData, to extract the version and index of a key.
- SerU32 🔒
- Serializer that extracts a u32, and rejects anything else.
Functions§
- key_
data_ 🔒parts - Decode a
slotmap::KeyData
into itsversion
andindex
components. - key_
version_ 🔒serde - Return the version encoded in
key
.