Support &str
, char
, etc as parsers when using Streaming
#79
Labels
A-input
Area: input / parsing state
C-question
Uncertainty is involved
M-breaking-change
Meta: Implementing or merging this will introduce a breaking change.
Please complete the following tasks
winnow version
0.2.0
Describe your use case
In #78, when porting the json example to streaming, I had to update the code with
one_of
/tag
. I also did it wrong and usedone_of
when I should have usedtag
which took some debugging to resolve.The problem is that whether we are streaming or not is a
const STREAMING: bool
generic parameter andchar
can't constrain it.Describe the solution you'd like
We could switch back to the original proposal in rust-bakery/nom#1535 of calling a function on
InputIsStreaming
, rather than taking a type parameterAlternatives, if applicable
Consider streaming a less common case that doesn't get all of the ease of use features
Additional Context
I had originally switch to the
const STREAMING: bool
parameter to move error reporting to compile time, rather than runtime. For example, the oldfinish
function would panic ifIncomplete
is returned. Panicing onis_streaming() == true
is better but having the compiler tell you this information is even better.The text was updated successfully, but these errors were encountered: