Commit Graph

655 Commits

Author SHA1 Message Date
Nathan McCarty ed3c6f0712 Add matrix chat badge to readme 2021-08-17 05:23:12 +00:00
Nathan McCarty 870c229c2c Add not-stale to stale-bot exempt tags 2021-08-12 21:07:16 -04:00
Ben Kimock 5c541a297a Optimize varint parsing (#337)
* Add benchmarks for varint parsing

* Enable more inlining

* Outline error construction

* Add provided functions to BincodeRead to customize reading of literals

* Add #[inline] to deserialize_byte

* Outline SliceReader::unexpected_eof so that deserialize_varint inlines

* Implement BincodeRead for std::io::BufReader

* Reimplement all of BincodeRead in terms of BufRead-like functions

* Move branch into error-creation function to get below inline threshold
2021-06-19 18:16:13 -07: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
Nathan McCarty ab8866317c Configure stale bot 2021-06-13 17:10:34 -04:00
Alex Touchet 9f5bcee5dd Edit version badge link (#389)
Co-authored-by: Nathan McCarty <nathan@mccarty.io>
2021-06-13 20:33:52 +00:00
Taehyung Lim 0d046e7b0e fix typo (#392) 2021-06-13 13:25:37 -07:00
Alex Touchet cd58cf2e7e Update URLs and some cleanups (#383)
* Update URLs and some cleanups

* Capitalize Rust

* Remove accidental directory

* Update URLs and some cleanups

* Update URL

* Capitalize Rust
2021-04-09 14:46:05 +02: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
Lena Hellström e15b8e911a clarify msrv support (#375)
* clarify msrv support

* pin byteorder to valid versions
2021-02-23 11:47:56 -08:00
Lena Hellström 72d301c284 update CI to new branching scheme (#376) 2021-02-23 11:46:57 -08:00
Manu c1b91d5a74 Fixed a stray comment. (#360) 2021-02-23 05:48:04 -08:00
Marc Brinkmann 99f22a3755 Address questions regarding suitability for storage and untrusted inputs (#346)
* Address questions regarding suitability for storage and untrusted inputs

Puts some prominent text into the `readme.md` regarding some use cases
that are likely to be common, along with a few hopefully helpful
pointers to avoid footguns.

Closes #345, closes #216, addresses #240, #266.

* Fix typos in `readme.md`

* Remove confusing sentence post 1.0, as requested
2021-02-23 05:42:24 -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 1bc63deb73 haha json go brrr (#324) 2020-05-23 15:24:08 -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 559b593ba3 create a security audit task (#314) 2020-04-16 15:53:21 -07:00
Lena Hellström 7efde421c8 add code coverage (#313) 2020-04-16 15:51:41 -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
Lena Hellström 38322212e6 update author name to current legal name 2020-03-09 18:39:39 -04:00
Kent Fredric d5579582e0 Restore shipping tests re bug #290
Includes changes to travis to re-run the test suite inside a copy
of the prepared package.

Closes: https://github.com/servo/bincode/issues/290
2020-02-21 14:08:44 -05: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
Leonard Kramer c48a064bad Fix compile warnings caused by deprecated macros. 2020-01-23 09:25:41 +00:00
jean-airoldie e2d8742743 Add contraints to {Serializer,Deserializer}Acceptor
This allows the user to retreive concrete types from the
serializer & deserializer output.
2020-01-23 09:23:48 +00:00
Joonatan Saarhelo 237e6852e9 remove unnecessary let in ReadReader 2020-01-21 09:21:43 +00:00
Joonatan Saarhelo 858cee9a22 deduplicate slicing logic SliceReader 2020-01-21 09:21:43 +00:00
Joonatan Saarhelo 28da4dbf56 improve documentation of BincodeRead 2020-01-21 09:21:43 +00:00
David Tolnay 6c4b23ce62 Release 1.2.1 2019-12-09 22:25:24 -08:00
David Tolnay 04cc5ba85f Merge pull request #281 from jstarry/fix-emscripten-builds
Fix emscripten build failures due to lack of i128 support
2019-12-09 22:25:00 -08:00
jean-airoldie a2d54866d4 Added Clone impl to Config 2019-11-04 07:46:43 -05:00
Josh Mcguigan c06b18abed improve safety of fill_buffer - see issue #260 2019-10-30 21:06:56 -04:00
Justin Starry 0215da2d29 Fix emscripten build failures due to lack of i128 support 2019-10-19 19:51:34 -04:00
Josh Matthews 293e9cea32 Release 1.2.0. 2019-09-24 14:16:47 -04:00
Josh Matthews d4d13aa37c Release 1.1.5. 2019-09-23 18:56:44 -04:00
alecmocatta 9d6e4f5ae6 Add tests 2019-09-06 17:38:28 -04:00
alecmocatta ecbef8d1bb add remaining _seed variants of deserialize functions 2019-09-06 17:38:28 -04:00
Alex Touchet 30ada4acda Readme cleanup 2019-07-25 17:11:51 -04:00