Skip to content
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

convert (usize, usize) for byte offsets into Range<usize> #12

Closed
QuietMisdreavus opened this issue May 3, 2017 · 1 comment
Closed
Labels

Comments

@QuietMisdreavus
Copy link
Collaborator

Right now, anything that gives text spans gives offsets as a tuple. This requires any substring access to go through a cumbersome text[range.0..range.1] to get the substring. Using std::ops::Range for these would greatly simplify getting these substrings.

@QuietMisdreavus
Copy link
Collaborator Author

Bah, never mind, Range isn't Copy. This would require cloning the Range out to prevent moving out of the struct, which is just as awkward.

Potential solution: functions that subslice the text for you, or generate the Range that you can then tweak. If the range is stored alongside the text, this could work, but I think Entities aren't, so we're back to the tuple/range conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant