BurntSushi / memchr

Optimized string search routines for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alternate API ordering suggestion

MavenRain opened this issue · comments

Perhaps it might be more ergonomic to be able to write something like haystack.memchr(b'z'). It's a simple change to make if there is an appetite for it, but would like to know what the community's thoughts are on it.

I think that's what bstr is for. It has things like <[u8]>::find_byte.

I would be open to an API refresh of memchr, but I think I would want to do that as part of a memchr 3 release, if ever. I'm not a huge fan of just adding a bunch of things to the API because it can create questions like, "wait, which one of these should I be using?" While I acknowledge the current API is perhaps not the most ergonomic, I think it's better than having two distinct APIs.

I'm going to close this because I don't think it's imminently actionable. I think it's very unlikely that I add a bunch of alternate-but-equivalent APIs to memchr 2, and this would instead need to be considered more holistically in a memchr 3 API refresh. However, I don't have any plans of doing that any time soon unfortunately.