toml icon indicating copy to clipboard operation
toml copied to clipboard

Consider making the fields of `Spanned` public

Open Kixunil opened this issue 2 years ago • 5 comments

I think Spanned should be just a POD with all its fields public or at least the value field should be. Not being public makes matching extra annoying.

My use case: I have a toml that allows setting one of two fields only if another is either not set or set to false (they are contradictory) so I deserialize both fields and then I match on the tuple of them emitting an error if an invalid combination is present (and convert to a proper enum a valid one is). I'd love to make the error message look as nice as Rust error messages - having "foo specified here" and "bar specified here" messages pointing at the places where they are specified. I need span for this so I'm refactoring the match.

Kixunil avatar Nov 09 '22 22:11 Kixunil