Closed mzabaluev closed 4 months ago
I think the TryFrom
impl generated for an enum is a separate case from the protobuf message decoding error.
It arises in a different context: the consumer tries to convert a field of an already decoded message to its nominal enum type.
DecodeError
, for its part, has all the data to represent a failure arising when a message is decoded.
I think the
TryFrom
impl generated for an enum is a separate case from the protobuf message decoding error. It arises in a different context: the consumer tries to convert a field of an already decoded message to its nominal enum type.DecodeError
, for its part, has all the data to represent a failure arising when a message is decoded.
That makes sense. I do think that DecodeError should be changed to a non_exthaustive enum instead of a string, but that is an issue for another day.
@mzabaluev The main prost
library is moved to a subdirectory. Could you solve the merge conflict?
The main
prost
library is moved to a subdirectory. Could you solve the merge conflict?
It's easy to do, but I will wait on #1068 to make sure tests pass.
It's easy to do, but I will wait on #1068 to make sure tests pass.
That PR is merged now
@mzabaluev The main
prost
library is moved to a subdirectory. Could you solve the merge conflict?
Done against 683091ae47c84545e22ee70ebbb1bbead9a8990e
DecodeError
as the error type of the generatedTryFrom<i32>
conversions for enum values is problematic:DecodeError
value makes an allocation even with a static message.format!
in the conversion impls, but that'll cost another allocation).Add a new
UnknownEnumValue
error type toprost
. Change theTryFrom<i32>
conversions generated for enums to use that as the associatedError
type. The error value carries the original integer as the public inner member.As this is a breaking change, it's not meant for 0.12, but for a future version.