Add an optional context for decoding allowing additional data to be passed to decoded structs.
---------
Co-authored-by: branchseer <dk4rest@gmail.com>
* Fixed a warning in a derive test that would cause CI to fail
* Fixed new clippy warning
* Commented out breaking cross builds
---------
Co-authored-by: Victor Koenders <victor.koenders@qrtech.se>
* Fixed broken miri CI script
* Disabled `test_std_file` in miri as it uses tempfile which is not supported
---------
Co-authored-by: Victor Koenders <git@trang.ar>
* Add missing test for encode_utf8
* Fix CI error by only run under std
* Merge test into testing framework for utf8 testing
---------
Co-authored-by: cxworks <cxworks@qq.com>
* feat: added Display and Debug implementations for Compat and BorrowCompat
* chore: added Compat and BorrowCompat Display and Debug tests
* chore: fixed imports and linter errors
* 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>
* Shrink `DecodeError` to 32 bytes on 64-bit arch
* Nul with a single l
* fmt
* Consider feature combinations for error sizes
* Remove superfluous `any`
* fmt
* Box SystemTime in EncodeError
* 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
* Switched to weak dependencies
* Removed old `serde_impl` references
* Fixed CI and updated documentation
* Fixed a cfg for a test
* Removed unneeded package in Cargo.toml
* Fixed cross platform targets
* Uncommented not working archs, with a reason why they fail
* Removed duplicate windows test
* Commented the other sun system
* Commented out i686-pc-windows-gnu
Co-authored-by: Victor Koenders <git@github.com>
* tests: fix alloc range test on 32-bit Windows
This test checks the range, which is necessarily different when running
on another platform.
Signed-off-by: Sean Cross <sean@xobs.io>
* enc: case usize/isize as u64/i64 in serialization
The deserialization process assumes that usize/isize are 64-bits, as
does the spec at
https://github.com/bincode-org/bincode/blob/trunk/docs/spec.md#varintencoding
Force `usize` and `isize` to be encoded as `u64` and `i64` to force
32-bit platforms to conform to this spec.
This fixes running tests under `cargo test --target i686-pc-windows-msvc`
Signed-off-by: Sean Cross <sean@xobs.io>
* atomic: only provide Atomic*64 on supported platforms
Not all platforms support AtomicI64 or AtomicU64. Use the
`target_has_atomic` config flag to determine whether to include these.
This fixes#532.
Signed-off-by: Sean Cross <sean@xobs.io>
* atomic: remove feature and use new attributes
Now that there is an attribute to indicate which atomic features are
supported on this platform, remove the `atomic` Feature and use these
new attributes.
Signed-off-by: Sean Cross <sean@xobs.io>
* alloc: run `cargo fmt`
Signed-off-by: Sean Cross <sean@xobs.io>
* Added cross platform tests
* Added all cross platforms
* Fixed an issue where `usize` and `isize` would be encoded wrong on 32 bit platforms
* Made the cross platform tests actually run on the platforms
* Disabled cross targets that don't build right now
* Fixed a failing test on 32 bit platforms, re-enabled all platforms for testing
* Disabled failing platforms
* Fixed an issue where serde would decode a sequence with an u32 instead of a usize
* Added serde to the `the_same` test for roundtrips, fixed several issues.
* Fixed backwards compatibility for result, ipv4addr and ipv6addr
* Processed feedback
* Fixed an error in bincode derive where it would implement the wrong trait if a generic parameter is present
* Reorganized the derive tests, added a roundtrip test for an enum with generics
* I didn't forget cargo fmt I swear
* Simplified some paths
* Moved Configuration::standard() and ::legacy() to the config module
* Fixed issue with config that would overwrite the limit, added a checklist on adding config variables
* 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