This module contains some shared code for encoding and decoding various
things from the
ty module, and in particular implements support for
“shorthands” which allow to have pointers back into the already encoded
stream instead of re-encoding the same thing twice.
The functionality in here is shared between persisting to crate metadata and persisting to incr. comp. caches.
- The shorthand encoding uses an enum’s variant index
usizeand is offset by this value so it never matches a real variant. This offset is also chosen so that the first byte is never < 0x80.
- Trait for decoding to a reference.
- Encode the given value or a previously cached shorthand.