Skip to content

Minor API revisions #12

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 4 commits into from
Jun 17, 2025
Merged

Minor API revisions #12

merged 4 commits into from
Jun 17, 2025

Conversation

natecook1000
Copy link
Member

  • Removes the ParserRange.slicing(_:) API
  • Adds throwing and optional collection/range subscripts
  • Adds an Endianness.isLittleEndian Boolean
  • Restricts seek(toRelativeOffset:) and seek(toOffsetFromEnd:) to current bounds of span

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 means that the `seek(toRelativeOffset:)` and
`seek(toOffsetFromEnd:)` are restricted to movement _within_
the current range of the span. This is how these are used, and is
a bit easier to explain because movement is therefore bound by both
ends of the span.

The `seek(toAbsoluteOffset:)` method still works with the original,
un-shrunken bounds, so has a different set of semantics (and may
benefit from a different name).
This API is the mirror image of the Collection subscript that is also
provided, and is the less natural way to spell the operation.
These should be consistent with the element-based subscripts.
@natecook1000 natecook1000 merged commit 4c66682 into main Jun 17, 2025
13 checks passed
@natecook1000 natecook1000 deleted the minor-api-revisions branch June 17, 2025 07:07
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.

1 participant