Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parser)!: Allow literals to be parsers of partial inputs #171

Merged
merged 2 commits into from
Feb 16, 2023

Conversation

epage
Copy link
Collaborator

@epage epage commented Feb 16, 2023

If you used Partial, you couldn't use "hello" as a tag but had to do
tag("hello") because we needed to constrain the generic parameter.
Now that we've removed it, literals can be used as desired.

The downside is that for FinishIResult, this shifts an error from
compile time to runtime. At least with is_partial_support, the user
is more likely to see it than they would have with the original nom
code.

BREAKING CHANGE: StreamIsPartial no longer takes a const PARTIAL: bool generic parameter. This was replaced with is_partial_support
function.

Fixes #79

If you used `Partial`, you couldn't use `"hello"` as a tag but had to do
`tag("hello")` because we needed to constrain the generic parameter.
Now that we've removed it, literals can be used as desired.

The downside is that for `FinishIResult`, this shifts an error from
compile time to runtime.  At least with `is_partial_support`, the user
is more likely to see it than they would have with the original `nom`
code.

BREAKING CHANGE: `StreamIsPartial` no longer takes a `const PARTIAL:
bool` generic parameter.  This was replaced with `is_partial_support`
function.

Fixes winnow-rs#79
@coveralls
Copy link

coveralls commented Feb 16, 2023

Pull Request Test Coverage Report for Build 4196027490

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 6 of 71 (8.45%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 52.665%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/bits/mod.rs 1 3 33.33%
src/bytes/mod.rs 0 2 0.0%
src/error.rs 0 5 0.0%
src/character/mod.rs 3 17 17.65%
src/stream/mod.rs 0 17 0.0%
src/number/mod.rs 0 25 0.0%
Totals Coverage Status
Change from base Build 4195751792: -0.3%
Covered Lines: 1719
Relevant Lines: 3264

💛 - Coveralls

@epage epage merged commit 57c3fc6 into winnow-rs:main Feb 16, 2023
@epage epage deleted the partial branch February 16, 2023 16:33
epage added a commit to epage/winnow that referenced this pull request Feb 16, 2023
This was supported previously through const generics but that went away
in winnow-rs#171.  Now, its a `debug_assert`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support &str, char, etc as parsers when using Streaming
2 participants