subslice
is a library of efficient subsequence matching, effectively a generalization of str::find
to both str
and [_]
.
It defines 2 functions which return the starting index of the (first, last) subslice of a given slice which is equal to another given slice:
fn find(&self, other: &Self) -> Option<usize>
fn rfind(&self, other: &Self) -> Option<usize>
I've been seeing some interest in the repo on GitHub so i'm explicitly announcing it. Happy hacking!