If you’re using nom (@geal), I upgraded https://crates.io/crates/glsl to nom-8.

You can have a look at the patch to give you an idea of the work it represents here: https://lists.sr.ht/~hadronized/glsl-devel/patches/57337

crates.io: Rust Package Registry

Most of the stuff I had to do:

- Some symbols moved from one module to another; simply change the use statement.
- Types have changed quite a bit for a trait-based approach. I have to be slightly more explicit for the error side.
- You pass impl Parser around everywhere now instead of FnMut.
- Parser application uses the trait method, so parser(i) is now parser.parse(i) or parser.parse_complete(i).
- That’s pretty much all.

Because GLSL is a programming language, I need to look at nom-language to see if I can reduce the amount of code I have after the migration, though.

I benchmarked and I’m a bit concerned. https://todo.sr.ht/~hadronized/glsl/1#event-406264

TL;DR: lots of regressions, ranging from x0.6 to (more impacting) x0.85.

@geal do you think trait methods could be not so « zero cost abstractions » in the end? :(

@hadronized could you show in which kinds of parsers you saw those, I suspect that it will require a few inline tags. The traits made a lot of function calls more explicit, and the compiler might not know how to inline it as well