Commit Graph

294 Commits

Author SHA1 Message Date
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 ecbef8d1bb add remaining _seed variants of deserialize functions 2019-09-06 17:38:28 -04:00
David Tolnay 18da2c95d5 Release 1.1.4 2019-05-14 21:16:49 -07:00
David Tolnay 107a1930b5 Update documentation to 2018 edition 2019-04-30 01:18:32 -07:00
David Tolnay c954d3352c Remove unneeded ```rust from rustdoc 2019-04-30 01:15:01 -07:00
David Tolnay 0a67cf66e7 Release 1.1.3 2019-04-07 17:28:48 -07:00
David Tolnay f5af5b992b Define html_root_url 2019-02-16 11:28:17 -08:00
Diggory Hardy a04c750960 Make i128 support automatic for supporting Rustc versions
Uses autocfg
2019-01-28 09:59:18 -05:00
Jeff Muizelaar 20da2c841a Make config() inline(always)
Without this we end up generating code for all configs unless LTO is on.
2018-11-20 11:13:44 -05:00
Ty Overby d8704644d7 format 2018-09-04 16:25:10 -07:00
boxdot 5633935964 Introduce `Config::deserialize_seed` for exposing serde's statefull deser. 2018-09-04 16:22:50 -07:00
Ashley Mannix 2ef9a06894 add support for 128bit numbers 2018-05-30 09:44:38 -07:00
Ty Overby 72f002cc0a some comment fixes 2018-02-13 16:24:57 -08:00
Ty Overby 5081ac7c08 remove unused function type parameter 2018-02-07 20:23:07 -08:00
Ty Overby 24b007e194 public but hidden read types 2018-02-07 20:13:26 -08:00
Ty Overby 3c5b38097f hide with_deserializer and with_serializer 2018-02-07 19:46:25 -08:00
Ty Overby 76b7662dcd move to custom read implementation for deserialize_in_place 2018-02-07 19:39:27 -08:00
Ty Overby 68ca894b81 add deserialize_in_place 2018-02-07 18:32:10 -08:00
Ty Overby b31151a605 2nd implementation of the Config Trait (#214)
* add option and config traits

* thread options everywhere

* add WithOtherLimit, WithOtherEndian, and update internal to take advantage of it

* wip

* add rest of the public API and fix tests

* dtolnay feedback

* remove serialized_size_bounded and replace it with a use of config

* remove inline from trait method

* finish documentation and add custom reader support

* minor config_map refactor

* doc changes

* add with_(de)serializer functions and their associated modules
2018-02-07 18:26:46 -08:00
Kyle Huey 093bc24a13 Elide unnecessary copy when consuming a byte buffer. (#223) 2017-12-01 10:26:08 -08:00
Markus Westerlind 7464ba7272 Allow serialized types to use a more compact representation ... (#217)
... by utilizing that bincode is not human readable.

Uses the changes in https://github.com/serde-rs/serde/pull/1044 which
allows data formats to report that they are not human readable. This
lets certain types serialize themselves into a more compact form as they
know that the serialized form does not need to be readable.

Closes #215

BREAKING CHANGE

This changes how types serialize themselves if they detect the
`is_human_readable` state.
2017-11-20 09:55:34 -08:00
Ty Overby 1cc66df1d5 add documentation to utf8_char_width 2017-10-13 17:58:53 -07:00
Ty Overby 1cf9a0eb56 fix doc comment for deserializing function 2017-10-13 17:48:55 -07:00
Ty Overby 47b66f55ce switched type parameter on deserializer 2017-10-13 17:44:36 -07:00
Ty Overby 251bbe22d4 remove _types from read module 2017-10-13 17:42:09 -07:00
Ty Overby 40889ec016 capitalize Bincode 2017-10-13 17:38:36 -07:00
Ty Overby de942273a0 remove infinite terminology from SequenceMustHaveLength message 2017-10-13 17:32:04 -07:00
Ty Overby 94b3de8f3c remove decding terminology from sizelimit error message 2017-10-13 17:29:44 -07:00
Ty Overby c696aac206 fix mistake 2017-10-13 10:17:58 -07:00
Ty Overby 7dc7a94560 improve size limit error display 2017-10-13 08:59:08 -07:00
Ty Overby 3a24da087b cargo fmt source 2017-10-13 08:57:04 -07:00
Ty Overby c8f02e30aa 177 invalid encodings (#212)
* split out invalid encoding errors

* detail breaking changes
2017-10-12 09:04:14 -07:00
Ty Overby 45e70e297e add ErrorKind::DeserializeAnyNotSupported (#211) 2017-10-11 10:38:35 -07:00
Ty Overby d04ba007dc remove references to old type (#210) 2017-10-11 09:53:45 -07:00
Ty Overby a135fd44dc uncapitalize error messages (#209) 2017-10-11 09:53:36 -07:00
Ty Overby 62941544ea rename doc functions (#208)
* fix up docs
2017-10-10 16:41:27 -07:00
Ty Overby ab70e7d507 remove completely unused dependency 2017-10-10 10:32:18 -07:00
Jeff Muizelaar d033583700 Forward read_exact() as well as read(). (#207)
If we don't do this we end up using the generic read_exact method
which is not necessarily optimal. This is especially when
using a specialized Read implementation to go fast.
See https://github.com/TyOverby/bincode/issues/206
2017-10-10 10:20:34 -07:00
Thomas Schaller f20770a09f Correct error message
Spotted the mistake while skimming over the code.
2017-09-10 17:25:32 +02:00
Lena Hellström 4777efdfaa take reader and writer by value (#200) 2017-07-23 21:58:29 -07:00
Lena Hellström 34aba9acbe Internal type names (#199)
* Remove internal type names from api

* Rename IoReadReader to IoReader
2017-07-23 21:57:53 -07:00
David Tolnay 2f1ab0a0e5 Revert whitespace changes from #194 2017-07-22 13:35:13 -07:00
David Tolnay d44adb148e Correctly report the cause of IO error
This was fixed in #195 but unintentionally reverted in #194.
2017-07-22 13:34:29 -07:00
David Tolnay 815c44287a Merge pull request #194 from dgriffen/io-variant-names 2017-07-22 13:32:46 -07:00
Lena Hellström 18bcfc420e Seal SizeLimit and BincodeRead 2017-07-22 14:37:08 -05:00
Lena Hellström b6dbb08f92 Correctlly report the cause of IoError (#195) 2017-07-20 10:12:36 -07:00
Lena Hellström d55bbf150f Remove naming redundancy with IoError 2017-07-18 21:54:23 -07:00
Ty Overby 8be2e87415 factor out some common functionality 2017-04-20 22:20:56 -07:00
Ty Overby cb7e9f87eb fix buffer length bug 2017-04-20 22:11:28 -07:00
Ty Overby 6692674f43 WIP Implement nocopy support for bincode (#150)
* basic infrastructure

* use BincodeRead internally

* fix zero copy behavior

* rearrange module layout; remove pub(crate)

* add size-limit safety checks when deserializing str or bytes

* fix-up tests
2017-04-20 18:27:22 -07:00
David Tolnay 7eccffd783 Update to serde 1.0 branch (#149)
* Update to serde 1.0 branch

* The serde 1.0 branch merged
2017-04-19 16:05:59 -07:00
Ty Overby b3acb6ea60 remove read_bytes (#143) 2017-03-22 13:08:37 -07:00
Ty Overby c6fa2358e5 add docs to everything that was undocumented 2017-03-20 17:32:55 -07:00
Ty Overby 975f82cfb8 add size_hints 2017-03-20 08:29:26 -07:00
Ty Overby 539637d78b remove refbox (#140) 2017-03-19 20:10:35 -07:00
Ty Overby 2b465047b9 Eager prealloc no inline (#127)
* make SizeLimit a trait

* always preallocate
2017-03-17 18:14:59 -07:00
Ty Overby f4c97fde6a make SizeLimit a trait (#124)
* make SizeLimit a trait

* move inline to the correct location
2017-03-17 17:59:12 -07:00
Ty Overby ed65f9abeb call read_bytes iteratively inside of read_vec (#138) 2017-03-13 09:24:38 -07:00
slyrz 05d1936caf Make read_vec more robust (#134)
* Make read_vec more robust

* Remove check for overflowing add

* Let the two read_vec functions become one again
2017-03-09 11:04:51 -08:00
slyrz 6c3b677dd7 Revamp deserialize_char (#133)
* Remove unneccesary unwrap

* Use a single buffer for reading a char

* Replace while loop with read_exact

* Remove first_byte variable

* Use read_exact to avoid waiting for data after EOF

* Create error in a closure
2017-03-09 11:02:27 -08:00
Olaf Buddenhagen 5784fe28ad Fix unintentional breaking API change in `Serializer`/`Deserializer` (#128)
While introducing selectable endianness in
https://github.com/TyOverby/bincode/pull/103 , the new type parameter
has been hidden from the public `serialize()`, `deserialize()` etc.
functions, and only made available through an alternate API entry point.
The same kind of encapsulation also needs to be performed for the public
`Serializer` and `Deserializer` types.
2017-03-01 17:14:11 -08:00
Ty Overby 1631cb2d80 Make Reader and Writer generic on Endianness (#103)
* Make Reader and Writer generic on Endianness

* make alternate API modules

* add test asserting that big endian encoding is different from little endian encoding

* clean up tests
2017-02-24 18:58:46 -08:00
Tim 3471118004 Smarter deserialize_bytes and deserialize_byte_buf (#115)
* Smarter deserialize_bytes

* Make read_vec faster by pre-allocating the correct amount of space.

Also, call visit_bytes in deserialize_bytes rather than visit_byte_buf.
2017-02-23 12:31:59 -08:00
Lena Hellström cac9301615 Remove InvalidEncoding struct (#111) 2017-02-10 10:19:58 -08:00
Lena Hellström ffbe4387dd Combine error types (#104)
* Combine error types

* Correct errors from merge conflict

* Create ErrorKind and Box it up

* Fix merge errors.

* Fix merge errors re-adding length encoding.
2017-02-09 23:07:20 -08:00
Lena Hellström 565b9c9f41 Remove length encoding (#102)
* Remove length encoding

* Improve bytes() test.
2017-02-03 09:27:03 -08:00
Lena Hellström 419411d004 Remove sized bounds where appropriate (#101)
* Remove sized bounds where appropriate

* Make bounds compatible with stable
2017-01-31 20:24:08 -08:00
Ty Overby e7a74aa6c2 Remove rustc serialize support (#95)
* Remove rustc_serialize support

* Add changelist and bump version number for alpha

* Move refbox and friends into own module

* update changelog

* update travis config

* move serde functions out into global namespace
2017-01-31 15:50:55 -08:00
Ty Overby 5bfd688819 change error message (#97)
* change error message

* add InfiniteSequence case to SerializeError

* Change name
2017-01-31 12:56:25 -08:00
Lena Hellström ab3f627ca8 Don't panic. (#96) 2017-01-31 11:21:07 -08:00
Lena Hellström c6393ac561 Update to serde 0.9.X (#93)
* Update to serde 0.9.X

* Remove redundant visitor and bad namespacing.

* Change DeserializeError to use Strings.

Reintroduce error tests.

* Better DeserializeError messages.

* Fix warnings.
2017-01-31 09:59:29 -08:00
David Tolnay 3d4346808f More efficient serialize_bytes (#90)
* Update to serde_derive

* Fix missing Encoder and Decoder imports

* Add test for serializing bytes

* More efficient serialize_bytes

Reported in #serde: blank_name2 tried serializing
`HashMap<String, HashSet<Bytes>>` vs `HashMap<String, HashSet<&Path>>`,
the `&Path` version was done in ~.6 seconds while the
`&[u8]` one took a full 3 seconds more.
2016-12-12 18:26:26 +00:00
Nikita Baksalyar 8d708cd194 Delegate emit_enum_struct_variant calls to emit_enum_variant (#89)
* Delegate emit_enum_struct_variant calls to emit_enum_variant

read_enum_struct_variant delegates calls to read_enum_variant which
expects u32 prefix to encode a variant number. Previous implementation
of emit_enum_struct_variant doesn't emit it, making serialized data
invalid.

* Add test to check manual enum encoding
2016-11-27 13:08:20 -08:00
Brian Bowman e96a3645fa Fix typo in bincode::serde (#88) 2016-09-20 16:03:54 -07:00
David Tolnay 95b414a184 Update to serde 0.8.0 (#84) 2016-07-28 12:23:18 -07:00
Cobrand c5073e83e5 pub used InvalidEncoding in serde+rustc_serialize so it shows in `cargo doc` (#82)
* Removed unused import warning

* pub use InvalidEncoding in serde+rustc_serialize

* Made both fields of InvalidEncoding public so it can be used without Display or Debug traits (e.g. pattern matching)
* Export of InvalidEncoding in rustc_serialize/serde make them visible in `cargo doc`
2016-07-08 06:53:43 -07:00
Oliver Schneider 2eee182f1f fix char serialization and deserialization 2016-06-30 14:02:07 +02:00
Dmitry e5a524ed28 Fixed size array deserialization (#76)
* Attempt to implement hint for fixed size arrays.

* Removed wrong visitor + tests.

* Removed extra new line.
2016-06-19 13:29:10 -07:00
David Tolnay 629d7bc640 Impl Deserialize for non-'static lifetimes (#79) 2016-06-19 13:23:21 -07:00
Ms2ger c7bdb4a90c Use num-traits. (#72) 2016-04-21 09:28:33 -07:00
Alexander Bulaev ff69e6f3e1 Add cargo features for rustc-serialize and serde (#70)
* Add cargo features for rustc-serialize and serde

If you only really need one of them

* Check that both "serde" and "rustc-serialize" are compiling

* Minor: change Travis build order
2016-04-15 11:03:32 -07:00
Ty Overby 21329a0e53 v0.5.3 2016-04-12 09:28:21 -07:00
Jayson Reis 183c28e363 Upgrade byteorder to 0.5.x (#68) 2016-04-12 09:26:18 -07:00
Brian Bowman 127380a506 fix typo 2016-04-07 03:05:41 -05:00
Ty Overby 772b1da6df Revert "Respect size limits in read_seq and read_map."
This reverts commit 1e21e5d13b.
2016-04-03 15:44:21 -07:00
Andrew Cann ce61edb51f Replace use of saturating_add 2016-03-10 17:27:51 +08:00
Andrew Cann 1e21e5d13b Respect size limits in read_seq and read_map. 2016-03-10 17:08:11 +08:00
Ty Overby bde9aa6565 add initial support for serde 0.7 2016-03-04 10:44:28 -08:00
Ty Overby 3e8833b70e Fix typo 2016-02-07 17:42:45 -08:00
Ty Overby 9824d8061c ignore instead of no_run 2016-02-07 17:03:47 -08:00
Ty Overby 7fba81da1e should parse now 2016-02-07 17:00:24 -08:00
Ty Overby 13d9e30813 no run on tests 2016-02-07 16:56:51 -08:00
Ty Overby 05850df34a Merge branch 'master' of github.com:TyOverby/bincode 2016-02-07 16:46:33 -08:00
Ty Overby 25cfb15823 add more docs 2016-02-07 16:46:23 -08:00
Ty Overby 7662a57727 add more useful syntax error messages 2016-01-19 08:46:33 -08:00
Ty Overby a63e80d75d add docs for the new modules 2015-08-07 23:16:35 -07:00
Ty Overby 0cfb64511c moved the two designs into modules 2015-08-07 17:35:27 -07:00
Ty Overby 9c6bf1aa41 remove unused code 2015-08-07 16:39:15 -07:00
Ty Overby 3de218537f Fix test fallout during merge 2015-08-07 16:16:42 -07:00
Erick Tryzelaar b59af483ef Updated to serde 0.5.0 2015-08-07 12:10:02 -07:00
Erick Tryzelaar f04635c1ba Add newtype handlers to speed up parsing newtype structs and variants 2015-07-30 20:45:36 -07:00
Erick Tryzelaar 8ec54e562a Update to serde 0.5.0 2015-07-29 13:15:14 -07:00
Erick Tryzelaar 0d6b8a48b6 Get serde working 2015-07-29 13:15:04 -07:00
Erick Tryzelaar b206032ff1 Initial support for serde serialization 2015-07-01 15:21:26 -07:00
Erick Tryzelaar f11ba0c41f Move tests into the tests/ directory 2015-06-30 07:52:18 -07:00
Ty Overby fd52ae0d64 Revert "Merge pull request #42 from jmesmon/fix-oom"
This reverts commit 1c3f457cf9, reversing
changes made to 84b5c416ca.
2015-05-29 13:50:16 -07:00
Ty Overby e8d783fdfc Revert "fail with size limit on large maps too"
This reverts commit ce286b2519.
2015-05-29 13:39:17 -07:00
Ty Overby ce286b2519 fail with size limit on large maps too 2015-05-28 16:12:46 -07:00
Ty Overby 1c3f457cf9 Merge pull request #42 from jmesmon/fix-oom
check the size of seqs before trying to decode them
2015-05-28 16:09:20 -07:00
Cody P Schafer ee0dccbd02 check the size of seqs before trying to decode them
Fixes #41
2015-05-28 16:03:02 -04:00
Cody P Schafer 9ab3320db7 SliceBox: allow Deref into &[T]
Allows more convenient use of SliceBox where one doesn't care whether
it represents a Vec<T> or &[T] and can handle using a &[T].
2015-05-28 12:05:30 -04:00
Ty Overby e3837055d7 Removes the "bytes read" return part from `decode`
This reverts commit 5fa0c2bd8a.

Conflicts:
	Cargo.toml
2015-05-18 23:28:39 -07:00
Jonathan Reem a19d62cbe9 Add some more trait impls and methods to StrBox and SliceBox 2015-05-04 03:48:25 -07:00
Ty Overby b6615fa262 derive debug for refbox and friends 2015-05-02 12:56:36 -07:00
Ty Overby 1d45873f1e cleaned up refbox implementation and added tests 2015-05-02 12:23:27 -07:00
Ty Overby 3d8f97923d strbox and slicebox 2015-05-02 03:52:27 -07:00
Ty Overby 5fa0c2bd8a Decoders return the number of bytes that they read
Closes #35
2015-05-01 09:17:18 -07:00
Ty Overby d87e7dad2d rustfmt 2015-04-29 23:26:58 -07:00
TyOverby 209b274062 remove dependency on the unicode library 2015-04-29 18:09:01 -07:00
Mohd Tarmizi 4e0f2457ac Fix rustdoc comment syntax
I also moved the comment block to the top of the file so that rustdoc won't throw "expected outer comment" error
2015-04-27 21:36:59 +08:00
Ty Overby 31572a2da5 remove use of the unicode library 2015-04-12 21:12:24 -07:00
Ty Overby cb3c84acd6 Merge branch 'master' of github.com:TyOverby/bincode 2015-04-12 21:04:29 -07:00
Ty Overby 92d6b95c2c remove reimplementation of read_exactly 2015-04-12 21:04:15 -07:00
TyOverby be66f5fed4 change wording of some docs 2015-04-07 13:35:11 -07:00
Cody P Schafer 6240bcfc31 refbox: add Debug impl 2015-04-03 15:42:18 -04:00
Ty Overby e5d0c33acd update for rustc 2015-04-02 12:24:05 -07:00
Mike Dilger a92429505a Update full slice syntax 2015-04-01 08:54:58 +13:00
Mike Dilger 883b1097ab Fix for upstream rustc changes 2015-04-01 08:41:50 +13:00
Mike Dilger fcc64883b6 Derive Clone,PartialEq for EncodingError 2015-03-26 15:55:03 +13:00
Ty Overby 1bbd5377e3 rustup 2015-03-25 15:50:41 -07:00
Ty Overby 575002877b removed warnings 2015-03-23 10:36:29 -07:00
Ty Overby 1355a93a23 Fix rustc updates. 2015-03-19 10:09:27 -07:00
Ty Overby bf4d6f637b clean up wording of docs 2015-03-08 15:42:35 -07:00
Cody P Schafer b9f201c792 Don't require BufRead, only Read
While BufRead is preferable to avoid dog-slow performance, requiring
when no methods are called is also problematic, especially for wrappers
around Read that shouldn't necessarily need to know they're wrapping
BufRead.
2015-03-02 17:23:10 -05:00
Ty Overby 5f85e9b19a Use new io, update for rustc changes 2015-02-21 21:42:59 -08:00
Ty Overby 28b5007731 mark new version 2015-02-21 21:05:30 -08:00
Ty Overby 29fde1b72f ignore doctests in refbox 2015-02-20 08:57:01 -08:00
Ty Overby 6c6d92ef45 feature new_io 2015-02-20 08:48:48 -08:00
Ty Overby f216e2575a add documentation to refbox 2015-02-18 15:08:03 -08:00
Ty Overby f5111f9476 Add RefBox.
RefBox is a structure for encoding references, and decoding them into
a box.  This makes it easy to nest structures that otherwise would not
be able to be nested and encoded.
2015-02-17 13:18:25 -08:00
Ty Overby 873815ab0a prepare for newio 2015-02-16 11:33:21 -08:00
Ty Overby b15b85797e added doc icon 2015-02-15 12:56:42 -08:00
Ty Overby 03966150c6 emit str using write_all 2015-02-09 18:19:23 -08:00
Ty Overby 15e7672703 prepare for the new io library 2015-02-09 14:56:40 -08:00
Ty Overby 2f3860ddab clean up tests 2015-02-07 18:25:28 -08:00
Ty Overby 58c3c65eea fix size estimation, add tests 2015-02-07 18:10:12 -08:00
Ty Overby 64a8877c55 add another test and change Show -> Debug 2015-02-05 01:18:44 -08:00
TyOverby 5952c3adb0 update for stdlib 2015-01-28 13:01:11 -08:00
Colin Sherratt 6a9011d2e3 Update to using Debug over Show.
Update the Error impls.
2015-01-24 19:27:19 -05:00