mirror of https://git.sr.ht/~stygianentity/bincode
Adds varint encoding to all numbers, including sequence lengths and enum discriminants. Varints are encoded according to the following scheme 1. If `u < 251`, encode it as a single byte with that value. 2. If `251 <= u < 2**16`, encode it as a literal byte 251, followed by a u16 with value `u`. 3. If `2**16 <= u < 2**32`, encode it as a literal byte 252, followed by a u32 with value `u`. 4. If `2**32 <= u < 2**64`, encode it as a literal byte 253, followed by a u64 with value `u`. 5. If `2**64 <= u < 2**128`, encode it as a literal byte 254, followed by a u128 with value `u`. Signed integers are first encoded using zigzag format (see docs for details) Co-authored-by: Maciej Hirsz <maciej.hirsz@gmail.com> Co-authored-by: Nicole Mazzuca <nicole@strega-nil.co> |
||
|---|---|---|
| .. | ||
| test.rs | ||