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

Conflicting DeserializeSeed impls for different deserializable types with the same seed type #2876

Open
starptr opened this issue Dec 29, 2024 · 0 comments

Comments

@starptr
Copy link

starptr commented Dec 29, 2024

Consider this struct:

struct B {
  c: ComplicatedType,
}

We have that ComplicatedType has a DeserializableSeed implementation for a seed of type &Seed. Therefore, struct B should have a DeserializableSeed implementation for a seed of type &Seed. However, when I try to do so:

impl<'de> DeserializeSeed<'de> for &SeedT {
  type Value = ComplicatedType;}

impl<'de> DeserializeSeed<'de> for &SeedT {
  type Value = B;}

this is an error because we are impling the same trait for the same seed twice. What's a good way to go about this?

More generally, is it possible to automatically derive (or minimize boilerplate for) DeserializeSeed for some type T wrt. a particular seed S when all of the inner types of T are already either Deserialize or DeserializeSeed wrt. S?

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