Skip to content

Commit

Permalink
Auto merge of servo#502 - bestouff:patch-1, r=jdm
Browse files Browse the repository at this point in the history
Explicit unnamed member example

Be a bit more explicit in the use of the `serde` attribute.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/502)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo authored Jun 7, 2019
2 parents 87dd8df + 9c1c61c commit c1914b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions url_serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ struct MyStruct {
}
```
# How do I use a data type with an unnamed `Url` member with serde?
Same problem, same solution.
```
#[derive(serde::Serialize, serde::Deserialize)]
enum MyEnum {
A(#[serde(with = "url_serde")] Url, OtherType),
}
```
# How do I encode a `Url` value with `serde_json::to_string`?
Use the `Ser` wrapper.
Expand Down

0 comments on commit c1914b3

Please sign in to comment.