| Crates.io | subslice-offset |
| lib.rs | subslice-offset |
| version | 0.1.1 |
| created_at | 2022-08-01 15:50:42.248131+00 |
| updated_at | 2022-08-01 16:06:51.600983+00 |
| description | Get offset of subslice in its parent slice |
| homepage | |
| repository | |
| max_upload_size | |
| id | 636905 |
| size | 2,962 |
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][SubsliceOffset::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