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

#1153 in Algorithms

Download history 3130/week @ 2024-11-15 3048/week @ 2024-11-22 2101/week @ 2024-11-29 2342/week @ 2024-12-06 3526/week @ 2024-12-13 886/week @ 2024-12-20 575/week @ 2024-12-27 1760/week @ 2025-01-03 1835/week @ 2025-01-10 1891/week @ 2025-01-17 1552/week @ 2025-01-24 1489/week @ 2025-01-31 1876/week @ 2025-02-07 1423/week @ 2025-02-14 1346/week @ 2025-02-21 1508/week @ 2025-02-28

6,455 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

~100–270KB