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 (if detected at runtime) which is even faster.
26- Using ``memchr`` for the single byte case, which is ultra fast.
27
28- ``twoway::find_bytes(text: &[u8], pattern: &[u8]) -> Option<usize>``
29- ``twoway::rfind_bytes(text: &[u8], pattern: &[u8]) -> Option<usize>``
30- ``twoway::find_str(text: &str, pattern: &str) -> Option<usize>``
31- ``twoway::rfind_str(text: &str, pattern: &str) -> Option<usize>``
32
33Recent Changes
34--------------
35
36- 0.2.1
37
38  - Update dev-deps
39
40- 0.2.0
41
42  - Use `std::arch` and transparently support SSE4.2 when possible (x86 and
43    x86-64 only) to enable an accelerated implementation of the algorithm.
44    Forward search only. By @RReverser and @bluss
45  - Fix a bug in the SSE4.2 algorithm that made it much slower than it should have been,
46    so performance increases as well.
47  - Requires Rust 1.27
48
49- 0.1.8
50
51  - Tweak crate keywords by @tari
52  - Only testing and benchmarking changes otherwise (no changes to the crate itself)
53
54- 0.1.7
55
56  - The crate is optionally ``no_std``. Regular and ``pcmp`` both support this
57    mode.
58
59- 0.1.6
60
61  - The hidden and internal test module set, technically pub, was removed from
62    standard compilation.
63
64- 0.1.5
65
66  - Update from an odds dependency to using ``unchecked-index`` instead
67    (only used by the pcmp feature).
68  - The hidden and internal test module tw, technically pub, was removed from
69    standard compilation.
70
71- 0.1.4
72
73  - Update memchr dependency to 2.0
74
75- 0.1.3
76
77  - Link to docs.rs docs
78  - Drop ``pcmp``'s itertools dependency
79  - Update nightly code for recent changes
80
81- 0.1.2
82
83  - Internal improvements to the ``pcmp`` module.
84
85- 0.1.1
86
87  - Add ``rfind_bytes``, ``rfind_str``
88
89- 0.1.0
90
91  - Initial release
92  - Add ``find_bytes``, ``find_str``
93
94License
95-------
96
97MIT / APACHE-2.0
98
99
100Interesting Links
101-----------------
102
103.. _`two-way algorithm`: http://www-igm.univ-mlv.fr/~lecroq/string/node26.html
104
105- Two Way: http://www-igm.univ-mlv.fr/~lecroq/string/node26.html
106- Matters Computational: http://www.jjj.de/fxt/#fxtbook
107
108
109Notes
110-----
111
112Consider denying 0/n factorizations, see
113http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00184.html
114