Hi dear rustaceans,
How to return a specific error from a deserialize_with
function ? Does map_err(de::Error::custom)
always builds a serde error from a custom error Enum
?
Thanks for you help.
Hi dear rustaceans,
How to return a specific error from a deserialize_with
function ? Does map_err(de::Error::custom)
always builds a serde error from a custom error Enum
?
Thanks for you help.
.map_err(de::Error::custom)
can use the Display
implementation of the error type to create an error message, so you'll want to pass in a type that displays as the appropriate error message. I say "can" because implementations are not required to use the Display
type at all - error types that can't allocate will often not store any data.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.