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

Port over nom-bitvec #564

Open
2 tasks done
kszlim opened this issue Jul 18, 2024 · 2 comments
Open
2 tasks done

Port over nom-bitvec #564

kszlim opened this issue Jul 18, 2024 · 2 comments
Labels
A-input Area: input / parsing state C-enhancement Category: Raise on the bar on expectations

Comments

@kszlim
Copy link

kszlim commented Jul 18, 2024

Please complete the following tasks

winnow version

0.6.13

Describe your use case

The bits module in winnow doesn't allow for different traversal orders over the bits and other bit level niceties.

Would be really ergonomic, I think including it directly into winnow (as opposed to nom's approach of having it as a plugin) would be very nice for a batteries included experience (and is less likely to bitrot).

Describe the solution you'd like

Supporting something like this (directly lifted from nom-bitvec):

fn parser(bits: &BitSlice<Msb0, u8>) -> IResult<&BitSlice<Msb0, u8>, &BitSlice<Msb0, u8>> {
    tag(bits![1, 0, 1, 0])(bits)
}

would be very ergonomic.

Alternatives, if applicable

No response

Additional Context

No response

@kszlim kszlim added the C-enhancement Category: Raise on the bar on expectations label Jul 18, 2024
@epage
Copy link
Collaborator

epage commented Jul 18, 2024

Wow, talk about rot

yet all three versions are for nom v7.

The downside to including this directly in is it adds bitvec to our publish dependencies. While I've been more liberal with breaking releases than bitvec, I am a bit hesitant to do so. This is independent of making it a feature. Most likely, at least initially, this would be a crate in the workspace. That at least addresses the problem of bitrot as everything would be updated together.

In general, I've wondered if winnow should be split up more to better focus on text vs binary though likely that wouldn't happen until open-namespaces feature is available.

@epage epage added the A-input Area: input / parsing state label Jul 18, 2024
@kszlim
Copy link
Author

kszlim commented Jul 18, 2024

Yeah, I think it makes sense to make it a crate in the workspace!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-input Area: input / parsing state C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

2 participants