Closed archseer closed 2 years ago
Sorry for taking so long to get to this!
The code mostly looks good to me. However, at the moment this will always panic when trying to slice at a non-char boundary. And this is a problem for a couple of reasons:
get_slice_byte()
to panic, whereas the intention of the get_*()
methods is that they never panic, they just return None
.&str
slicing error message.Nevertheless, I'm fine merging this as-is and cleaning that up myself when I (eventually) get around to it. But if you have the time and would like to tackle that yourself, let me know, and I'll hold off on merging.
On second thought, I think I'd rather tackle the clean up myself, because I'm realizing that to do it "properly" I'll want to rework some other things in Ropey as well. So I'll merge this as-is, and work on that myself when I get the time.
Should probably state in the docs that this is marginally faster than
slice()
if you already have byte indices but thatslice()
should be preferred for safety (index is always aligned).Fixes #49