Commit Graph

32 Commits

Author SHA1 Message Date
Lena Hellström bb3e60c94c Fix issue when a foreign `Err` pollutes scope (#758) 2025-03-10 17:48:46 +00:00
nhaef 3d1c4c339a Use qualified path for Result::Ok in bincode_derive (#757)
* Use qualified path for Result::Ok in bincode_derive

* add test
2025-03-10 13:15:20 +01:00
Lena Hellström 2c87442fe6 Decode context (#749)
Add an optional context for decoding allowing additional data to be passed to decoded structs.

---------

Co-authored-by: branchseer <dk4rest@gmail.com>
2025-03-06 09:54:43 +00:00
Trangar dc468b4bed Made arrays never encode their length (#625)
* 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>
2023-03-30 15:09:33 +02:00
trevyn 966c45544f Encode variant index instead of variant value (#593) 2022-10-18 11:56:53 +02:00
Trangar 974abe8661 Fixed the clippy Eq warning. (#574)
Added DecodeError::Io
Removed `PartialEq` on DecodeError
2022-08-18 15:57:18 +02:00
Maciej Hirsz bd07adea66 Shrink `DecodeError` from 48 to 32 bytes on 64-bit arch (#553)
* 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
2022-06-15 20:50:09 +02:00
Trangar 86e03aeda7 Rewrite: seperated Decode and BorrowDecode (#526)
* 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
2022-06-04 15:23:55 +02:00
Trangar d0fd1a98cd Fixed an error in bincode derive where it would implement the wrong trait if a generic parameter is present (#487)
* 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
2022-01-23 10:10:36 +01:00
Trangar 59b787cbf8 Moved Configuration::standard() and ::legacy() to the config module (#481)
* 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
2022-01-19 16:46:25 +01:00
Trangar 99707d0d0b Fixed derive impl on an empty enum (#462)
* Fixed derive impl on an empty enum

* Added DecodeError::EmptyEnum in case a user tries to decode an empty enum
2022-01-08 12:39:03 +01:00
Trangar 030905e7d5 Bump virtue 0.0.4 (#463)
* Updated breaking virtue changes in preperation of virtue 0.0.4 release

* Added contents of derive.rs test_macro_newtype
2022-01-08 12:11:24 +01:00
Trangar 7690da5203 Made the derive macros automatically implement the required traits on generic arguments (#454) 2021-12-14 15:18:13 +01:00
Trangar 404946f12b [Breaking change] Made all `decode_from_slice` also return the number of bytes read (#445) 2021-12-11 15:51:50 +01:00
李冬冬 ed57fd0810 Impl BorrowDecode for Option<&[u8]> and Option<&str> (#446)
Co-authored-by: Trangar <victor.koenders@gmail.com>
2021-12-10 19:50:24 +01:00
Trangar 7cb10d4ab3 Added test case for a borrowed str (#441) 2021-12-02 11:44:08 +01:00
Trangar cc13be30d4 split off BorrowDecode from Decode in bincode_derive (#432)
* 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
2021-11-07 10:57:35 +01:00
Trangar b4c46a789a Fixes for 427 (#428)
* Made bincode_derive handle empty lines of docs correctly
* Made bincode_derive properly support const generics
* Added support for enums with variants with fixed values
2021-11-07 10:31:15 +01:00
Lena Hellström 99de47a6c8 Reintroduce varint optimizations 2021-10-24 16:44:36 +02:00
Victor Koenders 707d0d238f Made all encode and decode functions always require a Config, removed _with_config functions 2021-10-21 14:19:40 +02:00
Lena Hellström e232454936 Refactor and rename encoders 2021-10-17 16:22:14 +02:00
Trangar a27b63b7fa Make bincode_derive 0 dependencies (#409)
Removed `syn`, `quote` and `proc_macro2` dependency
2021-10-12 15:53:02 +02:00
Victor Koenders 8e99d580b8 Removed `allow` attributes, fixed some warnings 2021-09-26 09:19:39 +02:00
Lena Hellström 044942891f Clean up the borrow crimes 2021-09-22 22:17:26 +02:00
Victor Koenders 254b87c6eb Moved all feature flags to src/features, made the CI run tests on all feature combinations 2021-09-22 16:23:27 +02:00
Victor Koenders 9c7fb85e0e Added support for slices, str, fixed size arrays. Added lifetime to Decode trait 2021-09-22 12:03:00 +02:00
Lena Hellström c83c36333d Add enum encode/decode derive 2021-09-20 23:06:25 +02:00
Lena Hellström 2d0254405b Add derive support for tuple structs 2021-09-20 16:56:17 +02:00
Lena Hellström e414cabd33 Add derive for Decodeable 2021-09-20 16:35:36 +02:00
Lena Hellström 8241e6c656 Add generic bound support to derive 2021-09-20 16:27:13 +02:00
Victor Koenders 723bdd312a Turned Config::INT_ENCODING back into a const, made a ton of varint_encode functions 2021-09-19 09:25:47 +02:00
Victor Koenders bab0cf4bd1 Started working on bincode_derive 2021-09-13 13:20:47 +02:00