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
Both the as_f64 and as_opt_f64 (see #5) functions throw away information:
as_f64 either coerces silently or errors the entire deserialization operation.
as_opt_f64 errors less, but contains no information on what went wrong when something goes wrong, as None has no inner value
It would make sense to add another function type as_res_f64, that keeps the error information around, so the downstream user can report and handle edge cases as desired.
The deserialization would then return `Res<f64, serde_this_or_that::Err>. The Error variant could contain:
The original value passed to as_res_f64, e.g. String("null") or bool::True etc.
Information on what failed, e.g. "bool cannot be coerced to f64"
There could also be different error kinds, so that users could handle them differently.
Before starting the implementation, it would probably be a good idea to work out the full behaviour matrix for various inputs
The text was updated successfully, but these errors were encountered:
Description
Both the
as_f64
andas_opt_f64
(see #5) functions throw away information:as_f64
either coerces silently or errors the entire deserialization operation.as_opt_f64
errors less, but contains no information on what went wrong when something goes wrong, asNone
has no inner valueIt would make sense to add another function type
as_res_f64
, that keeps the error information around, so the downstream user can report and handle edge cases as desired.The deserialization would then return `Res<f64, serde_this_or_that::Err>. The Error variant could contain:
as_res_f64
, e.g.String("null")
orbool::True
etc.There could also be different error kinds, so that users could handle them differently.
Before starting the implementation, it would probably be a good idea to work out the full behaviour matrix for various inputs
The text was updated successfully, but these errors were encountered: