Skip to content

Add url_serde crate with ser/de support for url::Url type - #274

Merged
bors-servo merged 1 commit into
servo:masterfrom
mhristache:master
Jan 28, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
mhristache:master

Conversation

@mhristache

@mhristache mhristache commented Jan 27, 2017 •

Copy link
Copy Markdown
Contributor

This is fixing #273


This change is Reviewable

@SimonSapin SimonSapin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A couple small things…

Comment thread url_serde/Cargo.toml Outdated
license = "MIT/Apache-2.0"

[dependencies]
serde = ">=0.9, <0.10"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equivalent to "0.9", so please use that. Same for serde_json below.

Comment thread url_serde/src/lib.rs

```
struct MyStruct {
#[serde(deserialize_with = "url_serde::deserialize",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you tried that this works in your project?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread url_serde/src/lib.rs Outdated

/// Serialises `value` with a given serializer.
///
/// This is useful to serialize Hyper types used in structure fields or

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace Hyper with rust-url

Comment thread url_serde/src/lib.rs Outdated
/// 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")]`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace hyper_serde with url_serde

Comment thread url_serde/src/lib.rs
}


#[test]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Comment thread url_serde/Cargo.toml Outdated
authors = ["The rust-url developers"]

description = "Serde support for URL types"
documentation = "http://servo.github.io/rust-url/url/index.html"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhristache

Copy link
Copy Markdown
Contributor Author

PR updated with your comments @SimonSapin

@SimonSapin

Copy link
Copy Markdown
Member

Looks great, thanks!

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 3feb089 has been approved by SimonSapin

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Test exempted - status

@bors-servo
bors-servo merged commit 3feb089 into servo:master Jan 28, 2017
bors-servo pushed a commit that referenced this pull request Jan 28, 2017
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 -->
@SimonSapin

Copy link
Copy Markdown
Member

@Ms2ger Ms2ger mentioned this pull request Feb 1, 2017
24 tasks done
takumi-earth pushed a commit to earthlings-dev/rust-url that referenced this pull request Jan 27, 2026
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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants