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

Complementary ByteSlice functions addition - find_not_byte / rfind_not_byte #155

Open
kam821 opened this issue Mar 27, 2023 · 1 comment
Labels
doc Documentation should be improved.

Comments

@kam821
Copy link

kam821 commented Mar 27, 2023

i've been working with bstr recently and noticed that the ByteSlice has some functions missing that would help to achieve API symmetry and reduce the potential overhead of unnecessary precondition checking.

find_byte/rfind_byte functions that utilize memchr/memrchr internally are available, however, their inverted cousins (find_not_byte/rfind_not_byte) are missing.

Currently it is necessary to use find_not_byteset/rfind_not_byteset that dispatch to scalar::inv_memchr/inv_memrchr if byteset.len() is equal to 1.

Best regards

@BurntSushi
Copy link
Owner

API symmetry isn't really a goal I have to be honest. It's definitely a consideration, and I do consider API symmetry valuable unto itself, but it is but one of many things that are valuable. For example, in this case, I personally think that find_not_byte is a very uncommon routine to need, and find it to be quite okay to need to use find_not_byteset instead.

I would be open to some documentation improvements that mention the use of find_not_byteset in the docs of find_byte.

@BurntSushi BurntSushi added the doc Documentation should be improved. label Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation should be improved.
Projects
None yet
Development

No branches or pull requests

2 participants