Skip to content

Usage of serde_as on field of enum's tuple variant #479

Answered by jonasbb
spikespaz asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there, most features of this crate are there to make it easier to use the derive macros serde::Serialize and serde::Deserialize in situations, which don't quite follow the usual rules and need some adjusting. Everything related to serde_as is part of that.

The problem with your ProjectIdentifier is that you are not deriving serde::Serialize or serde::Deserialize. The serde_as annotation on the u64 field will be converted into a serde annotation, but this is not understood by any of the derive macros. Therefore, you see the error. It seems like you forgot to derive serde::Deserialize or accidentally used SerializeDisplay instead of serde::Serialize.
SerializeDisplay does not interact with

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@spikespaz
Comment options

@jonasbb
Comment options

@spikespaz
Comment options

@spikespaz
Comment options

@jonasbb
Comment options

Answer selected by spikespaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #478 on June 15, 2022 06:29.