Commit Graph

39 Commits

Author SHA1 Message Date
Jonas Pleyer b2837bef3f derive `Debug` and simplify marker structs in config (#761)
* derive Debug for marker types

- this will also implement Debug for the derived Configuration type

* migrate to marker structs without fields
2025-03-12 14:51:36 +01:00
Lena Hellström ee23e86743 Derive Debug for Configuration (#759) 2025-03-10 18:07:44 +00:00
Trangar 7d402398cd Fixed new clippy lints (#721)
* Fixed new clippy lints

* Fixed doc formatting warning

---------

Co-authored-by: Victor Koenders <victor.koenders@qrtech.se>
2024-08-07 10:21:30 +02:00
Sebastian Hahn b31bb67c59 Add getters for current configuration values (#681)
This was inspired by suggestions provided in #598, thanks a lot to
@VictorKoenders.

Fixes #598.

Co-authored-by: Trangar <gpg@trangar.com>
2023-12-11 09:57:32 +01: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 6d995a74c7 Document configuration generics (#581)
Co-authored-by: Trangar <gpg@trangar.com>
2022-09-28 08:00:40 +00:00
trevyn cafb13eb95 Clarify config::legacy() doc to match config::standard() (#580) 2022-09-17 17:22:31 +02:00
Trangar c763e2f11e Implement Default for Configuration (#575) 2022-08-18 17:14:07 +00:00
Trangar 03450ac49f Made config::standard() implement .write_fixed_array_header() by default (#509)
* Made config::standard() implement .write_fixed_array_header() by default

* Fixed failing unit test

* Fixed formatting
2022-02-28 17:26:46 +01:00
Trangar 58dc788dfa Fix/issue 500 (#503)
* 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
2022-02-07 16:52:15 +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 a5e57d51d8 Update documentation (#480)
* Updated documentation

* Updated spec.md
2022-01-18 15:17:58 +01:00
Popog dbb9a43ccd feat: Make `Configuration` functions `const` (#456) 2021-12-16 09:53:15 +01:00
Trangar 63f4607992 Feature/config limit (#439)
* 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
2021-12-11 15:44:43 +01:00
Trangar 73616a3d62 Made the zigzag encoding examples compile and run (#421)
Made the zigzag encoding examples compile and run
2021-10-25 11:24:50 +02:00
Victor Koenders 4b25114c59 Processed some of the feedback 2021-10-18 10:18:47 +02:00
Lena Hellström 684f2562b1 Config rewrite (#412)
Rewrite the config system to be slightly more friendly to adding new options
2021-10-17 21:07:31 +02:00
Victor Koenders 960b6066cd Added an option to encode a fixed array length or to skip it 2021-10-14 21:31:47 +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 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 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 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 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 8a4eac82fb Made the encoder respect intencoding, implemented FixintEncoding 2021-09-19 08:28:38 +02:00
Lena Hellström e160c73acb a fresh new start 2021-06-19 19:31:34 +02: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
jean-airoldie 4aa2a44965 Added Debug impl to Config 2020-01-23 21:35:00 +00:00
jean-airoldie a2d54866d4 Added Clone impl to Config 2019-11-04 07:46:43 -05:00
alecmocatta ecbef8d1bb add remaining _seed variants of deserialize functions 2019-09-06 17:38:28 -04: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
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