5 releases

Uses old Rust 2015

0.2.3 Jul 12, 2021
0.2.2 Jan 25, 2019
0.2.1 Jan 22, 2019
0.2.0 Jul 23, 2018
0.1.0 Jul 23, 2018

#423 in Algorithms

Download history 1847/week @ 2024-03-14 1951/week @ 2024-03-21 1385/week @ 2024-03-28 2127/week @ 2024-04-04 2679/week @ 2024-04-11 3152/week @ 2024-04-18 2322/week @ 2024-04-25 2186/week @ 2024-05-02 2687/week @ 2024-05-09 2359/week @ 2024-05-16 2850/week @ 2024-05-23 2204/week @ 2024-05-30 2522/week @ 2024-06-06 2404/week @ 2024-06-13 2409/week @ 2024-06-20 1671/week @ 2024-06-27

9,439 downloads per month
Used in 30 crates (10 directly)

MIT/Apache

62KB
1K SLoC

Documentation

Fast substring search for strings and byte strings, using the two-way algorithm.

This is the same code as is included in Rust's libstd to “power” str::find(&str), but here it is exposed with some improvements:

  • subslice::SubsliceExt::find(&self, other: &Self) -> Option<usize>
  • subslice::SubsliceExt::rfind(&self, other: &Self) -> Option<usize>

Notes

Consider denying 0/n factorizations, see http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00184.html


lib.rs:

Generalization of str::find to both str and [_], see SubsliceExt for docs.

Dependencies

~170–340KB