You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let ret =
matchmatchmatch de::MapVisitor::visit_value(&mut visitor){Ok(val) => val,Err(err) => returnErr(From::from(err)),}{}{Ok(val) => val,Err(err) => returnErr(From::from(err)),};
We probably just want to special-case the case of an enum with no deserialized variants, and generate a one-line impl that unconditionally returns error.
The text was updated successfully, but these errors were encountered:
I can do this, but I'm wondering why you wouldn't just throw an error at compile time instead. Is it because you expect these enums to also be produced by a code-generator in some cases? Because if this were user-written code, it would seem non-sensical to ask to (de)serialize a value that can't itself be instantiated.
It isn't necessarily nonsensical in handwritten code. One example would be byteorder::BigEndian - see BurntSushi/byteorder#52 for the justification. Another case is cfg'd variants - concrete example - where you want the code to compile even with no features.
The generated code looks like this (click to expand)
Specifically, the problem is:
We probably just want to special-case the case of an enum with no deserialized variants, and generate a one-line impl that unconditionally returns error.
The text was updated successfully, but these errors were encountered: