It would provide better UX to add more details to the DecodeError constructor in the TomlError type by telling all errors that happened during decoding:
Does the toml crate provide better decoding than as_str() and friends? All such functions return Option<...> while it would be better to have Result<..., ...>
Does Rust have the analogue of the Haskell's Validation type to combine multiple errors and which can be used with toml?
Currently, when TOML decoding fails due to missing fields or mismatched values, the error doesn't specify the missing field:
The corresponding function also simply returns
Option<Config>
instead of providing more detailshttps://github.com/chshersh/tool-sync/blob/950b4028a619d33303548acd06056949dcec1a4a/src/config/toml.rs#L48-L64
It would provide better UX to add more details to the
DecodeError
constructor in theTomlError
type by telling all errors that happened during decoding:https://github.com/chshersh/tool-sync/blob/950b4028a619d33303548acd06056949dcec1a4a/src/config/toml.rs#L10-L14
Open questions:
toml
crate provide better decoding thanas_str()
and friends? All such functions returnOption<...>
while it would be better to haveResult<..., ...>
Validation
type to combine multiple errors and which can be used withtoml
?