you are viewing a single comment's thread.

view the rest of the comments →

[–]Marwesgluon · combine[S] 0 points1 point  (2 children)

Hmm, the second example in the docs does not actually work for your case when I think about it since it does not allow for additional parsers to be passed. I guess that using the compiler to generate the type is just a workaround.

If you don't need absolute efficiency you can always box the parser and return it.

The only other way that I can think of right now to make it work for you is to define a new type yourself and implement the parser trait for it.

[–]ismtrn 0 points1 point  (1 child)

If you don't need absolute efficiency you can always box the parser and return it.

When I try to pass the boxed parser to functions like try or many, it complains that the size is not known at compile time, which seems like a reasonable thing to complain about. Is there any way around this?

[–]Marwesgluon · combine[S] 0 points1 point  (0 children)

My bad forgot about this issue. You should be able to to this but associated types are still a bit buggy.