I have a &[u8]
slice over a binary buffer. I need to parse it, but a lot of the methods that I would like to use (such as str::find
) don't seem to be available on slices.
I've seen that I can covert both by buffer slice and my pattern to str
by using from_utf8_unchecked()
but that seems a little dangerous (and also really hacky).
How can I find a subsequence in this slice? I actually need the index of the pattern, not just a slice view of the parts, so I don't think split
will work.