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
SerandSerU32.
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::KeyDatainto itsversionandindexcomponents. - key_
version_ ๐serde - Return the version encoded in
key.