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

#[yaserde(flatten)] like #[serde(flatten)] ? #2

Closed
Boscop opened this issue May 13, 2018 · 3 comments
Closed

#[yaserde(flatten)] like #[serde(flatten)] ? #2

Boscop opened this issue May 13, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@Boscop
Copy link

Boscop commented May 13, 2018

It would be useful to have a way to "inline" struct fields into the parent struct for the purpose of (de)serialization, like this:

#[derive(YaSerialize, YaDeserialize)]
struct Common {
    a: i32,
}

#[derive(YaSerialize, YaDeserialize)]
struct Foo {
    #[yaserde(flatten)]
    common: Common,
    foo: u8,
}

#[derive(YaSerialize, YaDeserialize)]
struct Bar {
    #[yaserde(flatten)]
    common: Common,
    bar: u64,
}

Like #[serde(flatten)]

@MarcAntoine-Arnaud
Copy link
Contributor

I keep it in mind, but it's not my priority. If someone want to contribute, you are welcome !

@MarcAntoine-Arnaud
Copy link
Contributor

Hello @Boscop ,

@DmitrySamoylov has updated the project and supported flatten feature.
Is it ok for you ? if yes, close the issue.

@Boscop
Copy link
Author

Boscop commented Feb 24, 2020

Sorry for the late reply, I get too many notifications..
Yes, it's great, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants