Add an optional context for decoding allowing additional data to be passed to decoded structs.
---------
Co-authored-by: branchseer <dk4rest@gmail.com>
* Fix inconsistent naming between serde and non-serde functions
* Updated references from old deprecated function
---------
Co-authored-by: Victor Koenders <git@trang.ar>
* Made arrays with 32 elements or less never encode their length
* Removed `write_fixed_array_length` and `skip_fixed_array_length` as this was based on incorrect assumptions on how serde and bincode 1 works
---------
Co-authored-by: Victor Koenders <victor.koenders@qrtech.se>
* Improved encoding and decoding speed of Vec<u8>
* Added black_box calls to benches/string.rs
Added a SizeWriter because someone finally has a benchmark to show it's faster
* Improved performance for `impl<T> Encode for [T]`
* Added #[inline] to `impl Encoder for EncoderImpl`
---------
Co-authored-by: Victor Koenders <victor.koenders@qrtech.se>
* Add impl Encode for [T], where T: Encode
Since Encode takes a reference, this allows us to encode &[T] directly
using this implementation. The encoding scheme is the same as for
Vec<T>.
This also makes the implementation for &[u8] superfluous, since we get
an implementation for [u8] by virtue of u8 implementing encode. This
also gives us free implementations for &[u16], &[u32], etc. which is
quite useful. Nonetheless, we keep the implementation for &[u8] around,
because the implementation can directly write a large number of bytes,
which can be more efficient than the generic implementation.
* Remove redundant Encode implementations
Since we've implemented Encode for [T], this makes the implementation
for Box<[T]> redundant (since we have a blanket implementation for
Box<T>), and ditto for &[T], which this change replaces by combining the
implementations for [T] and &T.
* Reinclude comment about Encode specialization for &[u8]
* Rewrite: seperated Decode and BorrowDecode
* Fixed cargo.toml issues
* Fixed clippy warning
* Removed the `impl_tuples` macro call with manually exported code
* Replaced the generated code in `impl_tuples` with the macro instead
* Implemented BorrowDecode for Box<[T]>
* Added a test to see if zoxide can be ported to bincode 2
* Added a test for Arc<str>
* Made several `Encode` implementations require `T: ?Sized`
* Implemented Decode for Arc<str>
* Added BlockedTODO links to commented out code
* Fixed clippy and lint issues
* Updated virtue dependency in fuzz lockfile
* Added Limit<N> and NoLimit to the configuration
* Added a limit check to Decoder and DecoderImpl
* Added test cases, added a helper function specialized for containers
* Added a test to see if inlining makes the limit config faster, added inlining to the decoder
* split off BorrowDecode from Decode in bincode_derive
* Added test case for issue #431
* Fixed Cow implementation having the wrong constraint, added BlockedTODO for cow implementation specialization
* Re-exported the Decode and Encode traits in the crate root
* Removed outdated comments
* Removed some :🇩🇪:Decode that were introduced by the merge