Open BLucky-gh opened 4 months ago
By take_till
, I'm assume you are referring to the impl ContainsToken<T>
parameter that is used there and elsewhere.
That affects
one_of
none_of
take_till
take_while
This is an interesting one as I don't have a good feel for the trade offs of Fn
vs FnMut
with winnow.
For related conversations that might spark ideas:
For local context,
Looking back at nom's issues
Please complete the following tasks
winnow version
0.6.13
Describe your use case
I was trying to write a parser that runs
take_till
until it finds a matching bracket (keeping all the brackets found inside balanced), which requires a mutable counter variable to keep track of how many brackets have been found so farDescribe the solution you'd like
Allow passing
FnMut
totake_till
to allow for more complex parsers without needing to make the entire parser stateful or juggling data in and out of aCell
Alternatives, if applicable
I've used
Cell
and amove
closure to keep the closureFn
while still allowing for mutating the counter, but I feel like it makes the closure unnecessarily complicated and long just to deal with juggling data in and out of theCell
, so I think if there's no functional reason to constraint the parameter toFn
, it should be relaxedAdditional Context
https://github.com/winnow-rs/winnow/discussions/552#discussioncomment-10032721