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

Is there a way to ser/de a vector of remote type without implementing the trait explicitly? #1005

Closed
BusyJay opened this issue Jul 27, 2017 · 2 comments
Labels

Comments

@BusyJay
Copy link

BusyJay commented Jul 27, 2017

For example,

#[derive(Serialize, Deserialize)]
#[serde(remote = "B")]
struct A;

#[derive(Serialize, Deserialize)]
struct Array {
    bs: Vec<B>
}

#[serde(with = "A")] works only for singular field. Is there anything like #[serde(with_item = "A")]?

@dtolnay
Copy link
Member

dtolnay commented Jul 27, 2017

Not currently. We are tracking this in #723. I would love your thoughts on a design!

@genofire
Copy link

genofire commented May 11, 2020

How do i implementing the trait explicitly till #723 is resolved?


i am not able to find a function like, which i could use in the trait for serialize of Array:

let b = B{}
let mut a = A{};
serialize_as(&b, &mut a);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants