Every "port to Rust" post is the same shape: I rewrote it in Rust and it's faster. This one isn't. I ported a Python string-similarity library to Rust, and the honest story is mostly about proving the port, not writing it. The original's own tests pass unmodified. A differential fuzzer compares the two on hundreds of thousands of random inputs. And the hardest bug I fixed wasn't in the algorithms. It was in the tool that was supposed to be verifying them. It was telling me "0 divergences" while not actually testing most of the code.

That is the part nobody writes about. Here is the whole thing: what I picked, what broke, how I proved equivalence, the bug that ate a day, and the decision I would take back.

What I picked

textdistance is a pure-Python library with 30+ string-similarity algorithms: edit distances (Levenshtein, Damerau-Levenshtein, strcmp95), sequence metrics (LCS), token metrics (Jaccard, Sorensen), phonetic metrics, and a family of compression-based metrics (NCD) that literally compress your strings and compare the lengths. That last family is why this is a good port to attempt. The compression metrics need real liblzma and libbz2, so I vendor them through lzma-sys from a small C wrapper crate. The port is a Rust core (tdcore, #![forbid(unsafe_code)]) plus a thin PyO3 FFI (pyapi) plus a Python adapter package that keeps the exact public API, wrapped for distribution with maturin.