Skip to content

Commit c1914b3

Browse files
author
bors-servo
authored
Auto merge of #502 - bestouff:patch-1, r=jdm
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 -->
2 parents 87dd8df + 9c1c61c commit c1914b3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

url_serde/src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ struct MyStruct {
2727
}
2828
```
2929
30+
# How do I use a data type with an unnamed `Url` member with serde?
31+
32+
Same problem, same solution.
33+
34+
```
35+
#[derive(serde::Serialize, serde::Deserialize)]
36+
enum MyEnum {
37+
A(#[serde(with = "url_serde")] Url, OtherType),
38+
}
39+
```
40+
3041
# How do I encode a `Url` value with `serde_json::to_string`?
3142
3243
Use the `Ser` wrapper.

0 commit comments

Comments
 (0)