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 Deserialize only for specific session types #2869

Open
dpc opened this issue Dec 12, 2024 · 0 comments
Open

derive Deserialize only for specific session types #2869

dpc opened this issue Dec 12, 2024 · 0 comments

Comments

@dpc
Copy link
Contributor

dpc commented Dec 12, 2024

I have a type Address<V : NetworkValidation> that impls Deserialize only for Address<Unchecked>.

I'd like to use it in some other structs but derive Deserialize only for Address<Unchecked> :

#[derive(Serialize, Deserialize)]
#[serde(bound_type(deserialize = "Unchecked"))]
struct Foo<V> {
  address: Address<V>;
}

This should generate impl Desierialize for Foo<Unchecked>, by basically hardcoding V. This way the struct can remain generic. Existing bound is kind of like it, but for bounds, while I have a single (possibly multiple) concrete types only. Trying to make a sub-bound over V: NetworkValidation will not work AFAICT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant