Closed TheZoq2 closed 4 years ago
It's fine for me :+1: When I wrote the library, I wanted to experiments with nom and zero-copy parser. But for bibtex parsing, I don't think anyone would need the small performance boost gained by not copying some strings. And as you mentionned, it's much easier for the end-user at the end!
Yet another large PR, though this will probably be the last since the library works quite well with my project right now. This one might also be a bit more "controversial" than the previous ones.
Since string references were used in all the structures previously, owning anything parsed by the library was a bit of a pain since I had to deal with lifetimes, and ensure that the structures don't outlive the file they originated from. By changing to
String
, we sacrifice some performance to gain a lot of convenience. I hope you agree that it's a good tradeoff.I also considered adding a
Owned
version of all the structs, but that felt like more trouble than it's worth to me.