Closed ariroffe closed 2 years ago
This now looks good to merge; I replaced the error strings with an enum so that library consumers distinguish between the errors more conveniently. The error messages are still available through the Display
trait of the error enum.
Hi, in accordance with the issue I opened, I took the liberty of making this pull request. It adds a new method (in order to not break any existing code) to
Bibliography
, calledparse_result
, that returns aResult
instead of anOption
. TheErr
variant returns a string with the key of the entry that failed to parse. In the future, there could be a more complete explanation as to whyparse
failed / which fields were incorrect and why, but as a first approximation I think this works. I also added a couple of tests for it. Feel free to edit, of course (e.g. to modify the version of the package inCargo.toml
).