serde
serde copied to clipboard
derive `Deserialize` only for specific session types
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.