Compatibility
Function names alone do not determine match selection. Choose the match rules explicitly when porting.
Rust aho-corasick
| This library | Rust counterpart |
|---|---|
find_all, find_iter | find_overlapping_iter |
find_leftmost_longest | find_iter with MatchKind::LeftmostLongest |
mem | is_match |
Stream.feed_nonoverlapping | Earliest-end selection, like stream_find_iter with Standard |
Rust's find_iter is non-overlapping; this library's
find_iter includes overlaps. This library specifies
same-end ties as longest first, then lowest pattern index. The table
does not claim identical ordering in every Rust configuration.
Streaming and match kinds
Rust 1.1.5 supports streaming only with MatchKind::Standard.
This library also provides Stream.Leftmost_longest and
Stream.Replace, using bounded lookahead and an end-of-input flush.
There is no leftmost-first mode. Pattern order only breaks ties for identical match spans; it does not let a shorter pattern outrank a longer one.
Before porting
- Check whether offsets count bytes or characters, and whether the end is exclusive.
- Choose overlapping, earliest-end, or leftmost-longest selection.
- Check duplicate IDs, empty patterns, and ASCII versus Unicode case folding.
- Test the same chunk boundaries and consume the final flush where required.
Conformance and differential checks
The test suite ports vectors from Rust aho-corasick,
daachorse, and pyahocorasick. A CI harness also compares 20,000
generated cases with Rust aho-corasick 1.1.5,
pyahocorasick 2.3.1, and ahocorasick_rs 1.0.3.
Every shared Rust mode matched, including order. The Python results
and known iter_long differences are documented in
the harness report.
Scope
These results cover the pinned versions and generated cases above; they are not a compatibility claim for every implementation version.
Source: Rust 1.1.5 match-kind documentation.