Sam Sieber
0ecc730e64
Fix struct newtype deserialization (and add tests)
2018-11-19 08:59:04 -07:00
bors[bot]
199ed02274
Merge #30
...
30: Support deserializing a (keyword) string into a unit-only enum r=nox a=smangelsdorf
This adds support for deserializing a structure such as:
```rust
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
enum SortOrder {
Asc,
Desc,
}
#[derive(Serialize, Deserialize, Debug)]
struct SearchOptions {
sort: SortOrder,
}
```
This is already supported for serialization (and I've added a test case for the existing support as part of this PR), but attempting to deserialize the string `"sort=asc"` would result in the error:
```
invalid type: string "asc", expected enum SortOrder
```
I've made a sample in the playground of the way this is handled in `serde_urlencoded` vs `serde_json`: https://play.rust-lang.org/?gist=75fc1e5bbbc1eec29a472373d47488a0&version=stable
This brings the behaviour in line with the way `serde_json` currently handles this case, which I hope is appropriate. Happy to tweak the behaviour if there's a better way to handle it.
Co-authored-by: Shaun Mangelsdorf <s.mangelsdorf@gmail.com>
2018-08-14 10:53:15 +00:00
Shaun Mangelsdorf
4d220818f7
Implement deserialization into unit enums
2018-08-14 12:52:36 +02:00
bors[bot]
3ae5332931
Merge #32
...
32: Bump version to 0.5.2 r=nox a=nox
Co-authored-by: Anthony Ramine <n.oxyde@gmail.com>
2018-05-16 10:19:15 +00:00
Anthony Ramine
147bc9d93f
Bump version to 0.5.2
2018-05-15 22:19:04 +02:00
bors[bot]
f1499760e3
Merge #31
...
31: Bump itoa dep to 0.4.0 r=nox a=alex
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2018-05-15 19:58:04 +00:00
Alex Gaynor
b4804ad95a
Bump itoa dep to 0.4.0
2018-03-19 09:53:30 -04:00
bors[bot]
bdb7468bcb
Merge #25
...
25: Deserialize () from input without key/value pairs. r=nox
Currently there's no input that can be deserialized to `()`, this changes the crate to support deserializing strings without any key/value pair to a `()` (such as the empty string, or just `"&"`).
Would be great if you could release a patch for this, I have a project that needs this behavior.
EDIT: To expand on my use case, I have a trait which parses the body of an HTTP Request into a type (e.g. for a `POST` request). However, this is abstract over HTTP methods, and its expected to be able to parse an empty body (e.g. from a `GET` request) into `()`.
2017-05-21 07:34:36 +00:00
Without Boats
ecb91cfcd7
Deserialize () from input without key/value pairs.
2017-05-21 00:28:04 -07:00
bors[bot]
c5839b94e5
Merge #23
...
23: Update to serde 1.0.0 r=nox
2017-05-08 21:39:52 +00:00
Ted Driggs
abb8d81f9f
Update to serde 1.0.0
2017-05-08 17:18:53 +02:00
bors[bot]
43858d329e
Merge #22
...
22: Have a custom type for deserialising values (fixes #16 ) r=nox
2017-05-06 09:06:51 +00:00
Anthony Ramine
81aad8e8bd
Bump version to 0.4.3
2017-05-06 11:06:12 +02:00
Anthony Ramine
7ddde33a33
Have a custom type for deserialising values ( fixes #16 )
...
This lets us handle Option values correctly.
2017-05-06 10:59:42 +02:00
Anthony Ramine
f122a88561
Reformat de
2017-05-06 10:43:25 +02:00
bors-ng[bot]
c0457909e4
Merge #13
...
13: Inline docs of reexports and bump version to 0.4.2
2017-02-05 13:47:23 +00:00
Anthony Ramine
a8def0d865
Inline docs of reexports and bump version to 0.4.2
2017-02-05 14:46:33 +01:00
bors-ng[bot]
9931bc5318
Merge #12
...
12: implement deserialization of std::io::Read
2017-02-05 13:36:49 +00:00
Arthur Skobara
8839c6a86c
Introduce de::from_reader
2017-02-05 14:34:14 +01:00
bors-ng[bot]
4ef7cc6e85
Merge #11
...
11: Update serde to 0.9.3 and use serde::ser::Impossible
2017-01-31 09:59:17 +00:00
Anthony Ramine
b24505bcfe
Bump to 0.4.1
2017-01-31 10:57:22 +01:00
Anthony Ramine
a2fb94e32d
Add a couple of categories
2017-01-31 10:57:10 +01:00
Anthony Ramine
bc8197c884
Update serde to 0.9.3 and use serde::ser::Impossible
2017-01-31 10:52:21 +01:00
bors-ng[bot]
2cc32847ac
Merge #10
...
10: Update to serde 0.9.0 and various improvements
2017-01-29 09:30:09 +00:00
Anthony Ramine
3e9ebe4fd7
Bump version to 0.4.0
2017-01-29 10:25:43 +01:00
Anthony Ramine
fba478f827
Add bors configuration
2017-01-29 10:25:43 +01:00
Anthony Ramine
f5b1ae8828
Do not forbid bool keys anymore
...
Floats are supported so...
2017-01-29 10:22:40 +01:00
Anthony Ramine
5625c254e5
Use dtoa to not allocate a String to serialize a float
2017-01-29 10:22:40 +01:00
Anthony Ramine
1d88bbb26b
Use itoa to not allocate a String to serialize an integer
2017-01-29 10:22:39 +01:00
Anthony Ramine
e140c2b5c5
Use void for the unreachable serializers
2017-01-29 10:22:39 +01:00
Anthony Ramine
fa8fb69da0
Do not allocate a String to serialize a bool
2017-01-29 10:22:39 +01:00
Anthony Ramine
9960d5af2d
Update to serde 0.9.0 ( fixes #7 )
2017-01-29 10:22:30 +01:00
Anthony Ramine
8e5cf19e07
Reformat with rustfmt
2017-01-27 22:56:04 +01:00
Anthony Ramine
9aefb1c02d
Bump version to 0.3.0
2016-10-23 12:25:45 +02:00
Anthony Ramine
5202ee622b
Support Option values in the sequence serializer
...
This allows us to serialize sequences of Option<(K, V)> values.
2016-10-23 12:13:09 +02:00
Anthony Ramine
f9c64eb16c
Support serializing top-level Option values
2016-10-23 11:56:27 +02:00
Anthony Ramine
39f7d33b0b
Use opaque structs instead of opaque tuples
...
Opaque struct tuples leak their arity.
2016-10-23 11:55:16 +02:00
Anthony Ramine
7e09a773cd
Bump version to 0.2.2
2016-09-22 14:39:38 +02:00
aelita-mergebot
87e0352ead
Add support for boolean values
...
Merge #5 a=@mre r=@nox
________________________________________________________________________
2016-09-22 05:34:33 -07:00
Matthias Endler
f553c4e08f
Add support for boolean values
2016-09-22 14:31:05 +02:00
Anthony Ramine
c75cccbb03
Bump version to 0.2.1
2016-09-19 11:22:15 +02:00
aelita-mergebot
db248d7ea9
Add support for option parameters
...
Merge #4 a=@mre r=@nox
________________________________________________________________________
2016-09-19 02:09:39 -07:00
Matthias Endler
f639279e3e
Add support for option parameters
2016-09-18 19:15:03 +02:00
Anthony Ramine
042a5eb077
Fix number version in README
2016-09-11 21:29:47 +02:00
Anthony Ramine
56ee81e398
Update to 0.2.0
2016-09-11 18:50:46 +02:00
Anthony Ramine
967549d859
Add convenience functions ( fixes #2 )
2016-09-11 18:49:29 +02:00
Anthony Ramine
b0794d23e3
Remove the T parameter from Deserializer
...
No idea how that ended up there.
2016-09-11 18:43:22 +02:00
Anthony Ramine
6a21acd172
Make Serializer borrow its inner url-encoded serializer
...
While at it, create Serializer::new to actually instantiate it.
2016-09-11 18:36:15 +02:00
Anthony Ramine
6ec689b376
x-www-form-urlencoded meets Serde
2016-09-11 13:44:28 +02:00