这是indexloc提供的服务,不要输入任何密码
Skip to content

Tags: SimonSapin/serde_urlencoded

Tags

v0.5.5

Toggle v0.5.5's commit message
Merge nox#54

54: Don't use CowStrDeserializer (fixes nox#53) r=nox a=nox



Co-authored-by: Anthony Ramine <n.oxyde@gmail.com>

v0.5.4

Toggle v0.5.4's commit message
Merge nox#45

45: Fix struct newtype deserialization (and add tests) r=nox a=samsieber

Fixes nox#41

I only had to fix the deserializer - the serialization already works. So now they work the same way - you can serialize something and then deserialize it losslessly. 

I also added tests for serialization and deserialization. Let me know if there's anything you'd like changed.

Co-authored-by: Sam Sieber <swsieber@gmail.com>

v0.5.3

Toggle v0.5.3's commit message
Merge nox#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>

v0.5.2

Toggle v0.5.2's commit message
Merge nox#32

32: Bump version to 0.5.2 r=nox a=nox



Co-authored-by: Anthony Ramine <n.oxyde@gmail.com>

v0.5.1

Toggle v0.5.1's commit message
Merge nox#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 `()`.

v0.5.0

Toggle v0.5.0's commit message
Merge nox#23

23: Update to serde 1.0.0 r=nox

v0.4.3

Toggle v0.4.3's commit message
Merge nox#22

22: Have a custom type for deserialising values (fixes nox#16) r=nox

v0.4.2

Toggle v0.4.2's commit message
Merge nox#13

13: Inline docs of reexports and bump version to 0.4.2

v0.4.1

Toggle v0.4.1's commit message
Merge nox#11

11: Update serde to 0.9.3 and use serde::ser::Impossible

v0.4.0

Toggle v0.4.0's commit message
Merge nox#10

10: Update to serde 0.9.0 and various improvements