-
-
Notifications
You must be signed in to change notification settings - Fork 778
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
Implement visit_i128
and visit_u128
for ContentVisitor
#2230
Comments
Any obvious blockers on this? I am running into the same issue with untagged enums, caused by the same underlying missing variants. In addition (and likely out of scope for this issue, but related) - is there a public API for hand-writing |
+1. Just spent a few hours debugging the problem, thanks to Would be happy to provide a fix, if need be. |
I'm working with a library that only supports 128-bit integers for its data format. It is a self describing format which means it implements
deserialize_any
. It mostly works fine with serde out of the box because there is a custom visitor impl that implements thevisit_*128
methods.The issue I have only rears its head when I derive Deserialize on an untagged enum. The debugger drops me in a
Content::deserialize
, which callsdeserializer.__deserialize_content(actually_private::T, visitor)
that takes aContentVisitor
.serde/serde/src/private/de.rs
Lines 297 to 298 in 56bd369
ContentVisitor
does not implementvisit_i128
andvisit_u128
. Which I assume is because there is noContent::I128
andContent::U128
variants.serde/serde/src/private/de.rs
Lines 220 to 249 in 56bd369
So the default
visit_*128
methods get called instead causing the error I end up getting.serde/serde/src/de/mod.rs
Lines 1362 to 1376 in e1c4517
I implemented a quick solution that ought to be less intrusive but it ends up breaking multiple libraries, including
serde_json
, that use theUnexpected::*
enum. In fact, in my case it broke so many libraries that I have decided to take a different approach to the problem.master...appcypher:appcypher/content-visitor-i128
128-bit integers have been part of stable Rust for years now and with more people working with 128-bit integers, I think it is worth finding a permanent solution to this problem.
The text was updated successfully, but these errors were encountered: