Commit Graph

254 Commits

Author SHA1 Message Date
Victor Koenders 19fed15463 Added support for tuples with up to 8 values 2021-10-14 20:33:03 +02:00
Victor Koenders e4e12c984b Added support for the bool type 2021-10-14 19:34:35 +02:00
Victor Koenders c4cb220fb2 Added support for char encoding/decoding 2021-10-14 19:28:28 +02:00
Victor Koenders b480d2b3b3 Added documentation for the src/ module. Added warning for missing docs, fixed missing docs in src/de/mod.rs 2021-10-14 18:04:13 +02:00
Victor Koenders 7b85fc168e Added documentation for the src/featyres module 2021-10-14 18:01:41 +02:00
Victor Koenders bb98b8fcbd Added documentation for the src/enc module 2021-10-14 17:59:23 +02:00
Victor Koenders ea75220cd0 Added documentation for the src/de module 2021-10-14 17:30:52 +02:00
Victor Koenders 84344af2c6 Removed unneeded Config trait constraints 2021-10-12 18:23:39 +02:00
Victor Koenders a8680ce1d8 Started working on documentation 2021-10-12 18:18:43 +02:00
Victor Koenders c969622384 Added alloc and std tests 2021-10-12 16:13:21 +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
Lena Hellström 4b672de110 Enable non-slice readers 2021-09-22 15:08:52 +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
Victor Koenders ffb565c405 Added config options for endian and int_encoding, added full coverage for all basic integer types 2021-09-22 10:40:27 +02:00
Victor Koenders 78cb27f782 Added decode_ fns 2021-09-22 09:59:13 +02:00
Lena Hellström c83c36333d Add enum encode/decode derive 2021-09-20 23:06:25 +02:00
Lena Hellström e414cabd33 Add derive for Decodeable 2021-09-20 16:35:36 +02:00
Victor Koenders f914b3e580 Added unit tests for encode_signed 2021-09-19 11:24:42 +02:00
Victor Koenders 1313e989ad Added unit tests for decoding errors 2021-09-19 11:02:33 +02:00
Victor Koenders ca353b9882 Added decode_unsigned 2021-09-19 10:53:07 +02:00
Victor Koenders ccca6ee49e Split Error into EncodeError and DecodeError 2021-09-19 10:52:21 +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 7448b7bb87 Moved Encoder to its own file 2021-09-19 08:34:14 +02:00
Victor Koenders 6802edc625 Renamed blob to slice 2021-09-19 08:30:28 +02:00
Victor Koenders 8a4eac82fb Made the encoder respect intencoding, implemented FixintEncoding 2021-09-19 08:28:38 +02:00
Victor Koenders bab0cf4bd1 Started working on bincode_derive 2021-09-13 13:20:47 +02:00
Lena Hellström b7c0d1fac0 reorganize de/enc modules 2021-06-20 00:12:10 +02:00
Lena Hellström e160c73acb a fresh new start 2021-06-19 19:31:34 +02:00
Taehyung Lim 0d046e7b0e fix typo (#392) 2021-06-13 13:25:37 -07:00
Lena Hellström e39a047b4b prep branch for 2.0 work (#379)
* prep branch for 2.0 work

* switch to 2018 edition

* fix clippy issues

* fix tests

* fix warnings

* fix formatting
2021-04-08 14:54:31 +02:00
Lena Hellström 810086e473 fix linting ci error (#377) 2021-02-23 12:09:15 -08:00
Manu c1b91d5a74 Fixed a stray comment. (#360) 2021-02-23 05:48:04 -08:00
Andy Goetz 5d6dfa1fb9 Update docs to highlight differences between DefaultOptions and functions (#373)
Due to historical reasons, the default options used by bincode for the
helper functions at the root of the crate differ from the options in
the `config` module.

Changing the default options is a breaking change, so until a decision
is made, we can at least document the current behavior.
2021-02-23 05:33:55 -08:00
luben karavelov 5a134cf991 Fix `WithOtherTrailing` and `WithOtherIntEncoding` (#342)
They should be Copy/Clone as the rest of the Options

Closes #341
2020-07-20 10:22:30 -07:00
Lena Hellström 00c43bf3b1 fix logic error in fill_buffer (#336) 2020-06-23 23:41:55 -07:00
Alyssa Ross 4a57853a3b Fix Deserializer::{from_slice, with_reader} types (#332)
Having these in the impl block with a generic R paramter would make
them unusable, at least without type annotations:

    error[E0282]: type annotations needed
      --> msg_socket2/src/socket.rs:45:32
       |
    45 |         let mut deserializer = Deserializer::with_reader(bytes.as_slice(), DefaultOptions::new());
       |                                ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `R`

    error: aborting due to previous error

    For more information about this error, try `rustc --explain E0282`.

Moving these into separate impl blocks, which set the type of the
Deserializer to the return type of the functions, fixes this error.
2020-06-23 10:47:00 -07:00
Lena Hellström a822c09d93 bump version to 1.3.0 (#330) 2020-06-04 21:20:43 -07:00
Lena Hellström 752262a03d update documentation to reflect new config options (#329) 2020-06-04 21:20:00 -07:00
Lena Hellström e80f61b9da Reject trailing bytes (#198) 2020-05-26 12:40:04 -07:00
Lena Hellström f9faa33686 refactor config module (#323)
Break up the config module into one submodule per configuration
option. This commit also changes the default configuration with
the new options system to be varint (the old system still uses
fixint to preserve backwards compatibility).
2020-05-18 22:46:12 -07:00
Lena Hellström c27e9c6874 Varint enum tags and lengths (#306)
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>
2020-05-18 17:07:10 -07:00
Lena Hellström 2355e48a7b expose default options and serializers (#310)
Deprecate the old config system and make a refined version of the internal config system public. Doing allows the Serializer/Deserializer to be exposed since all of its generic type parameters are now public.
2020-04-16 15:23:07 -07:00
Lena Hellström 8839b0600d Modernize CI (#311)
Switches our CI from Travis-CI to Github Actions. At the same time this also turns on clippy and rustfmt linting.
2020-03-24 14:33:13 -07:00
Lena Hellström ae8c162d49 remove unsafe code in IoReader (#309) 2020-03-19 17:46:13 -07:00
Lena Hellström 15379ee5b2 Overoptimize slice reader (#308)
The default read implementation on slices was not generating efficient code. This custom implementation generates much smaller assembly with fewer function calls.
2020-03-18 14:54:54 -07:00
jean-airoldie 4aa2a44965 Added Debug impl to Config 2020-01-23 21:35:00 +00:00
Leonard Kramer 3a3857ff38 Remove dyn 2020-01-23 09:25:41 +00:00