Return error from deserialize_with()

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.