Repository navigation
Add url_serde crate with ser/de support for url::Url type - #274
Conversation
SimonSapin
left a comment
There was a problem hiding this comment.
Looks good! A couple small things…
| license = "MIT/Apache-2.0" | ||
|
|
||
| [dependencies] | ||
| serde = ">=0.9, <0.10" |
There was a problem hiding this comment.
This is equivalent to "0.9", so please use that. Same for serde_json below.
|
|
||
| ``` | ||
| struct MyStruct { | ||
| #[serde(deserialize_with = "url_serde::deserialize", |
There was a problem hiding this comment.
If you tried that this works in your project?
There was a problem hiding this comment.
Yes, it does. I would like to add a test case for it but it will need rust nightly until rust 1.15 is released. Is it ok to have a test that run on nightly only?
There was a problem hiding this comment.
We want to keep running the rest of the tests on stable Rust on Travis. We could add a Cargo feature and enable it based on $TRAVIS_RUST_VERSION, but I think it’s not worth the bother. I ok with just the non-automated test that you did.
|
|
||
| /// Serialises `value` with a given serializer. | ||
| /// | ||
| /// This is useful to serialize Hyper types used in structure fields or |
| /// Serialises `value` with a given serializer. | ||
| /// | ||
| /// This is useful to serialize Hyper types used in structure fields or | ||
| /// tuple members with `#[serde(serialize_with = "hyper_serde::serialize")]`. |
There was a problem hiding this comment.
Replace hyper_serde with url_serde
| } | ||
|
|
||
|
|
||
| #[test] |
There was a problem hiding this comment.
Please add a (cd url_serde && cargo test) line after (cd idna && cargo test) in Makefile, so that this test is run on Travis-CI. (Note that the indentation needs to be an actual tab character, not spaces.)
| authors = ["The rust-url developers"] | ||
|
|
||
| description = "Serde support for URL types" | ||
| documentation = "http://servo.github.io/rust-url/url/index.html" |
There was a problem hiding this comment.
Please change the documentation URl to https://docs.rs/url_serde/
|
PR updated with your comments @SimonSapin |
|
Looks great, thanks! @bors-servo r+ |
|
📌 Commit 3feb089 has been approved by |
|
⚡ Test exempted - status |
Add url_serde crate with ser/de support for url::Url type This is fixing #273 <!-- 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/274) <!-- Reviewable:end -->
Add url_serde crate with ser/de support for url::Url type This is fixing servo#273 <!-- 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/274) <!-- Reviewable:end -->
This is fixing #273
This change is