-
Notifications
You must be signed in to change notification settings - Fork 94
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
Off by one index in Memchr iterator #13
Comments
Uh... That seems surprising to me and sounds like a bug. cc @cholcombe973 |
Yeah I seem to recall the problem was if I didn't return the needle position plus one it would get stuck in a infinite loop. |
sigh OK. Returning the index + 1 doesn't seem right to me at all. I really wish I caught that. This has to be fixed. The question now is whether this requires a |
It seemed right at the time :-/. I think I was using it to split strings. |
Any update on this? It would be nice to be zero-based IMO. |
Fixed in #18. Note that we decided it would be best to do a memchr 2 release for this change. |
It seems surprising to me that when using the Memchr iterator, the position that is returned when calling .next() is the position of the needle + 1. Looking at the tests of the crate, this is expected behavior. Could you please explain why it is this way? I could then make a PR with additional documentation and an example to show usage of the Memchr (and Memchr2/3) iterator.
The text was updated successfully, but these errors were encountered: