Add allocation-free UTF-8 string iteration#10173
Open
lukewilliamboswell wants to merge 4 commits into
Open
Conversation
lukewilliamboswell
marked this pull request as ready for review
July 16, 2026 02:30
ESRogs
reviewed
Jul 16, 2026
| ## Drop a byte count from the start of a string. Counts at or beyond the | ||
| ## byte length return `Ok("")`; an in-range cut inside a UTF-8 code point | ||
| ## returns `Err(BadUtf8)`. Valid slices do not allocate. | ||
| drop_first_bytes : Str, U64 -> Try(Str, [BadUtf8, ..]) |
Contributor
There was a problem hiding this comment.
What would you think of having the error be something like NotACharacterBoundary instead?
The argument being that BadUtf8 makes it sound (to me) like there was something wrong with the original string itself, whereas the error actually comes from the count param cutting into it in a bad place.
Collaborator
Author
There was a problem hiding this comment.
~~Sounds good, I'll change it. ~~ actually I decided to leave it so it's consistent with all the others. I think this kind of idea would be better discussed in Zulip with everyone before we commit to an API deviation
This was referenced Jul 16, 2026
lukewilliamboswell
force-pushed
the
str-utf8-iteration-json-scanning
branch
from
July 17, 2026 22:58
0b9fe5e to
16dc53d
Compare
lukewilliamboswell
force-pushed
the
str-utf8-iteration-json-scanning
branch
from
July 20, 2026 01:05
16dc53d to
d0a0d3b
Compare
…on-scanning # Conflicts: # design.md # src/canonicalize/NodeStore.zig # src/compile/static_data_exports.zig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
This PR is stacked on #10145, which should merge first.
Closes #7010
Summary
Testing
zig build minici(62/62 passed)