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

#906 in Algorithms

Download history 2414/week @ 2024-08-04 2412/week @ 2024-08-11 2678/week @ 2024-08-18 3564/week @ 2024-08-25 3558/week @ 2024-09-01 2005/week @ 2024-09-08 2394/week @ 2024-09-15 3115/week @ 2024-09-22 2743/week @ 2024-09-29 2680/week @ 2024-10-06 3039/week @ 2024-10-13 3000/week @ 2024-10-20 2658/week @ 2024-10-27 2754/week @ 2024-11-03 2589/week @ 2024-11-10 3145/week @ 2024-11-17

11,247 downloads per month
Used in 33 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

~105–275KB