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

Missing impls when using nom 8 with bits #1826

Open
jgeibel-burns opened this issue Feb 14, 2025 · 0 comments
Open

Missing impls when using nom 8 with bits #1826

jgeibel-burns opened this issue Feb 14, 2025 · 0 comments

Comments

@jgeibel-burns
Copy link

In #1747 the InputLength trait was removed and all bounds were transitioned over to Input. However, Input is only implemented for &[u8] and &str whereas InputLength was also implemented for (&[u8], usize), [u8; N], &[u8; N], and &[T] (for any T, not just u8).

In particular, the loss of the (&[u8], usize) implementation seems to have broken many combinators when used with items under nom::bits. In my attempt to port to nom 8, I'm running into issues with combinator::eof and multi::many_till though I expect users would run into issues using any of the functions with modified bounds under those 2 modules. (I'm not currently using anything under bytes or character so the impacts there, and due to the other dropped impls, is less clear to me.)

Here is a reduced test case that compiles for me with nom 7 but not nom 8:

use nom::bits::bits;
use nom::combinator::eof;
use nom::error::Error;
use nom::{IResult, Parser as _};

fn main() {
    let _ = test(b"");
}

fn test(bytes: &[u8]) -> IResult<&[u8], ()> {
    bits::<_, _, Error<(&[u8], usize)>, _, _>(eof)
        .map(|_| ())
        .parse(bytes)
}
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

No branches or pull requests

1 participant