Open pjhuxford opened 5 months ago
Makes sense to me, but returning a struct thats not from the lib, nor from std is kinda annoying.
Yeah it is annoying that IndexMap
isn't in std, although it does seem like the most performant way to handle this. Maybe storing the keys of the tags in a Vec<String>
is a better approach though. What do you think?
Currently the tags of a bibliography entry are stored in a
HashMap
, which means the order of the tags is unstable.I have a use-case in mind where I would like to parse a bibliography entry from a file, perform some minor edits, and then write the new entry back to the same file. If I use
nom-bibtex
for the parsing then I have no way to recover the original order of the tags in the entry. This could potentially make the version control history of the file confusing to decipher.If you're also interested in remembering the order of the tags, I suppose one option would be to replace
HashMap
withIndexMap
from the indexmap crate. Another option would be storing aVec<String>
of the keys alongside theHashMap
.