1 2This is my substring search workspace. 3 4Please read the `API documentation here`__ 5 6__ https://docs.rs/twoway/ 7 8|build_status|_ |crates|_ 9 10.. |build_status| image:: https://travis-ci.org/bluss/twoway.svg?branch=master 11.. _build_status: https://travis-ci.org/bluss/twoway 12 13.. |crates| image:: http://meritbadge.herokuapp.com/twoway 14.. _crates: https://crates.io/crates/twoway 15 16Documentation 17------------- 18 19Fast substring search for strings and byte strings, using the `two-way algorithm`_. 20 21This is the same code as is included in Rust's libstd to “power” ``str::find(&str)``, 22but here it is exposed with some improvements: 23 24- Available for byte string searches using ``&[u8]`` 25- Having an optional SSE4.2 accelerated version which is even faster. 26- Using ``memchr`` for the single byte case, which is ultra fast. 27 28Use cargo feature ``pcmp`` to enable SSE4.2 / pcmpestri accelerated version (only the forward search). 29 30- ``twoway::find_bytes(text: &[u8], pattern: &[u8]) -> Option<usize>`` 31- ``twoway::rfind_bytes(text: &[u8], pattern: &[u8]) -> Option<usize>`` 32- ``twoway::find_str(text: &str, pattern: &str) -> Option<usize>`` 33- ``twoway::rfind_str(text: &str, pattern: &str) -> Option<usize>`` 34 35Recent Changes 36-------------- 37 38- 0.1.8 39 40 - Tweak crate keywords by @tari 41 - Only testing and benchmarking changes otherwise (no changes to the crate itself) 42 43- 0.1.7 44 45 - The crate is optionally ``no_std``. Regular and ``pcmp`` both support this 46 mode. 47 48- 0.1.6 49 50 - The hidden and internal test module set, technically pub, was removed from 51 standard compilation. 52 53- 0.1.5 54 55 - Update from an odds dependency to using ``unchecked-index`` instead 56 (only used by the pcmp feature). 57 - The hidden and internal test module tw, technically pub, was removed from 58 standard compilation. 59 60- 0.1.4 61 62 - Update memchr dependency to 2.0 63 64- 0.1.3 65 66 - Link to docs.rs docs 67 - Drop ``pcmp``'s itertools dependency 68 - Update nightly code for recent changes 69 70- 0.1.2 71 72 - Internal improvements to the ``pcmp`` module. 73 74- 0.1.1 75 76 - Add ``rfind_bytes``, ``rfind_str`` 77 78- 0.1.0 79 80 - Initial release 81 - Add ``find_bytes``, ``find_str`` 82 83License 84------- 85 86MIT / APACHE-2.0 87 88 89Interesting Links 90----------------- 91 92.. _`two-way algorithm`: http://www-igm.univ-mlv.fr/~lecroq/string/node26.html 93 94- Two Way: http://www-igm.univ-mlv.fr/~lecroq/string/node26.html 95- Matters Computational: http://www.jjj.de/fxt/#fxtbook 96 97 98Notes 99----- 100 101Consider denying 0/n factorizations, see 102http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00184.html 103