#slice #offset #finding #parent #subslice

subslice-offset

Get offset of subslice in its parent slice

2 releases

0.1.1 Aug 1, 2022
0.1.0 Aug 1, 2022

#20 in #parent

Download history 19/week @ 2024-09-23 23/week @ 2024-09-30 40/week @ 2024-10-07 207/week @ 2024-10-14 3/week @ 2024-10-21 47/week @ 2024-10-28

267 downloads per month

WTFPL license

3KB

A tiny utility crate for finding the offset of a subslice within another slice. Note that this is not done through pattern matching but with pointer arithmetic instead.

To use, simply include this crate and use the [SubsliceOffset] trait. The subslice_offset method should then appear on [slices][slice].

I do not take any credit for this crate, full credit goes to https://stackoverflow.com/a/50781657

No runtime deps