Skip to content

Make ParserSpan noncopyable #15

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

Merged
merged 1 commit into from
Jul 11, 2025
Merged

Make ParserSpan noncopyable #15

merged 1 commit into from
Jul 11, 2025

Conversation

natecook1000
Copy link
Member

This change helps communicate the intended usage of ParserSpan, though it doesn't strictly prevent creating a copy that represents the same memory. Specifically, the seeking(...) methods return copies of the span with different boundaries, to support separate parsing of different subregions of memory, and calling e.g. seeking(toRelativeOffset: 0) returns an exact copy of the parser span.

With a few changes inside the library to handle these explicit copies, this change is fully source compatible with all the included example parsers, further showing that it matches the intended usage and semantics of the library.

Resolves #13.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

This change helps communicate the intended usage of `ParserSpan`,
though it doesn't strictly prevent creating a copy that represents
the same memory. Specifically, the `seeking(...)` methods return
copies of the span with different boundaries, to support separate
parsing of different subregions of memory, and calling e.g.
`seeking(toRelativeOffset: 0)` returns an exact copy of the parser
span.

With a few changes inside the library to handle these explicit copies,
this change is fully source compatible with all the included example
parsers, further showing that it matches the intended usage and
semantics of the library.
@natecook1000 natecook1000 merged commit 2ddef13 into main Jul 11, 2025
13 checks passed
@natecook1000 natecook1000 deleted the noncopyable branch July 11, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: make ParserSpan ~Copyable.
1 participant