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
#1916 added support for #[serde(expecting = "...")] for providing a custom message to the generated Visitor::expecting() method. This works great for specifying a custom message when deriving Deserialize.
I am wondering if it would be possible to expand this behavior to specify a custom function, rather than just a string. Something like:
The motivation for this is to allow slightly more involved expecting logic, supporting custom messages based on the flags provided by fmt::Formatter. While this can be accomplished currently with custom Deserialize implementations, I would like to use the derived Deserialize impl with only the expecting() method changed.
Is this something that could be supported in serde?
The text was updated successfully, but these errors were encountered:
#1916 added support for
#[serde(expecting = "...")]
for providing a custom message to the generatedVisitor::expecting()
method. This works great for specifying a custom message when derivingDeserialize
.I am wondering if it would be possible to expand this behavior to specify a custom function, rather than just a string. Something like:
The motivation for this is to allow slightly more involved
expecting
logic, supporting custom messages based on the flags provided byfmt::Formatter
. While this can be accomplished currently with customDeserialize
implementations, I would like to use the derivedDeserialize
impl with only theexpecting()
method changed.Is this something that could be supported in serde?
The text was updated successfully, but these errors were encountered: