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

#[derive(Schema)] not working with StructVariants #89

Open
jamesmunns opened this issue Feb 2, 2023 · 2 comments
Open

#[derive(Schema)] not working with StructVariants #89

jamesmunns opened this issue Feb 2, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@jamesmunns
Copy link
Owner

The following fails:

#[derive(Serialize, Deserialize, MaxSize, Schema)]
enum Example {
    VarA,
    VarB(u32),
    VarC {
        d: u8,
        e: u16,
    }
}

with

error[E0308]: mismatched types
  --> src/main.rs:45:9
   |
45 |         d: u8,
   |         ^
   |         |
   |         expected `&NamedValue`, found struct `NamedValue`
   |         help: consider borrowing here: `&d`

The derive macro is likely not handling struct variants correctly at the moment.

@jamesmunns
Copy link
Owner Author

Tagging @lachlansneff, in case you are interested in tackling this!

@jamesmunns jamesmunns added the help wanted Extra attention is needed label Feb 16, 2023
@barafael
Copy link

barafael commented Apr 1, 2024

I'll grab this one

barafael added a commit to barafael/postcard that referenced this issue Apr 1, 2024
Not sure if the test was wrong or the serialization is wrong.
For now, I'm after jamesmunns#89, so I'll just make the test green to see if my changes break anything.
barafael added a commit to barafael/postcard that referenced this issue Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants