Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to deserialize Vec<Url> #420

Closed
hh9527 opened this issue Dec 21, 2017 · 4 comments
Closed

[Question] How to deserialize Vec<Url> #420

hh9527 opened this issue Dec 21, 2017 · 4 comments

Comments

@hh9527
Copy link

hh9527 commented Dec 21, 2017

use url::Url;

#[derive(Debug, Deserialize)]
struct Foo {
    #[serde(with = "url_serde")] // this works
    some_url: Url,

    #[serde(with = "url_serde")] // this does not work
    urls: Vec<Url>
}
@clarfonthey
Copy link

You currently can't use with this way; see serde-rs/serde#723.

@SimonSapin
Copy link
Member

Support for Vec<Url> probably needs to be added specifically to url_serde, similar to how it supports Option<Url> today.

@SimonSapin
Copy link
Member

url 2.0 will support serde 1.x directly (and serializing Vec<Url> should "just work"), without the url_serde crate. Therefore the url_serde crate will likely not get more features.

@waf
Copy link

waf commented Feb 12, 2021

For anyone else finding this issue via Google, you can enable serde support for urls by enabling the "serde" feature:

url = { version = "2.2.0", features = ["serde"] }

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

No branches or pull requests

4 participants