-
Notifications
You must be signed in to change notification settings - Fork 492
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
[De]serialize ZId in human readable form #1330
Conversation
806f56c
to
0ee44e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5ac9690
to
656ba10
Compare
I've tried to generify
Could be so, that the |
Is this a limitation of serde crate? I wonder how other types with fixed byte arrays handle it. |
Sorry, should indeed have put some more context in the issue. In the PR, I came to the requirement to (de)serialize a struct that has a field I did not want to write another copy-pasted Here's a way of limitations I've crossed:
#[derive(serde::Serialize, serde::Deserialize)]
struct Something {
#[serde(with = "foo")]
foo: Bar,
} you're tied to the
requirement and all the logic for "recursively descending into types" you'll have to write yourself somehow. That's why we now have
This is what I've tried to do first, the
So feels like even if I dig into and find a way to fix the
I might have missed some other ways or could approaching my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rust-fu is pretty basic, still in rust rewiring my head phase 😃
That said I find this abstraction a bit confusing. Just looking at HexZid types, it's not immediately clear why they're needed. I gather we're trying to workaround some serde limitation. But I don't know much serde internals to make any meaningful comments here.
Is it possible to add custom serialize/deserialize for specific collection types? I'm not sure what's better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
It is possible, similar way it's currently done for Now for every type you have to write the same two functions, one set for And if there's no way to write those I've tried to document those new types, will do a bit better. |
656ba10
to
e9f46e0
Compare
e9f46e0
to
835bd1a
Compare
I'm having a hard time following serde thread. In either case we don't have a backwards compatible migration path right? |
Noting is broken now, besides the whole api being wrecked in #1286 |
No, I was referring to serde fixing this but that's unknown at this point anyway. |
Yes, alas it's safe to assume that's not going to happen reasonably soon. |
Attempts to replace the
opt_display_serde
stub with something more generic, that would work forHashMap<...>
to make zenith part from #1286 more serializable