ByteSlice should offer more functions taking u8
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
I'm using bstr to help parse a few formats, some of them are text (but not necessarily utf8) and some of them are binary but contain strings.
I have a few things that I wished were present:
-
The various
splitfunctions should have variants for passing a byte instead of just str/char. I ended up usingsplit_str(b"\0")andsplit_str(b"\xff")a few times which is going to be less efficient than directly invoking memchr. -
Versions of
fields_with/trim_start_with/trim_end_withwhich pass their function the byte instead, and don't bother with UTF-8 decoding.
It seems possible that you're more interested in this being useful for probably-text case than for (e.g. the emphasis is on the str, and not the b). If that's the case, sorry for this and the next bug I'm going to file!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing split functions and the fields_with, trim_start_with, and trim_end_with implementations in the bstr source. Compare their current string- and character-based behavior, then determine the byte-oriented variants and verify that they avoid UTF-8 decoding while preserving the existing APIs and semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100