~tdeo/serde_bare

ref: 9ebade856b357fa2e50c760bfdc029f84db4057c serde_bare/src d---------
Update documentation
7538e31a — Enrico Lumetti 7 months ago
Do not accept sequences with no length information
Remove Error::IdentifierUnsupported

This is a breaking change.
Deserialize Enum discriminant as Uint

The serializer encodes the variant of an enum as a BARE Uint, so the
deserializer should do the inverse when trying to deserialize a message.

Serde's serialize interface only receives variant indexes as u32,
despite the compiler allowing a cast to virtually any primitive integer
type.
Improve variable-length integer robustness

Move the maximum length check above the left shift, so we don't try and
shift more than 64 bits into the accumulator.

Return serde::de::Errors from the invalid branches of the Uint
deserialization implementation rather than panicking on bogus or
truncated input.

Also clean up a Clippy lint in the Uint serialize implementation, using
the .take(i) iterator adapter rather than a ranged for-loop.
only test u128 when serde's 128-bit integers are enabled
minor whitespace changes
clean up read_bytes
Stop blindly allocating fields based on length

If we allocate and zero the memory for a length-prefixed field up front,
it makes it trivial to DOS the deserializer by sending an enormous
length prefix.

Instead allocate at most one page of memory, growing the Vec as required
to accomodate the data actually available in the incoming buffer.
Update documentation
Miscellaneous updates
Switch from u32 to uint for lengths
Add Uint/Int types (variable length)
Clarify some allowed behaviour to allow varint deserialization

Since custom functions can't be used in Deserialize implementations,
we have to use some existing functions in special ways.
Fix char support

Previously, this would call the visitor's u32 functions.
Remove useless closures
Add i128/u128 support using data<16>
Remove references to enum types
Add a few deserialization tests
Next