You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 far
Describe the solution you'd like
Allow passing FnMut to take_till to allow for more complex parsers without needing to make the entire parser stateful or juggling data in and out of a Cell
Alternatives, if applicable
I've used Cell and a move closure to keep the closure Fn 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 the Cell, so I think if there's no functional reason to constraint the parameter to Fn, it should be relaxed
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
#552 (comment)
The text was updated successfully, but these errors were encountered: