Damerau Levenshtein implementation with Pyo3

Hi there! I'm in the process of learning Rust, and it is amazing!
In my first project, I try to implement the Damerau Levenshtein as a python package with Pyo3. The first tests are working. However, compared to the C implementation, my Rust code runs 90% slower. Furthermore, I don't know how I can make the arguments generic to all types of objects (Compare the C implementation). Currently, my code only compares Integer lists.

My request: Is there someone who can review my code and may suggest improvements to boost the runtime?
Thank you!
Best,
Jonas

Edit: I know that there are a lot of crates that already implement the dl distance. However, I want to compare list of objects and not only strings.

Commenting without looking at the code yet ..

The two most popular replies to "Why doesn't my Rust code run as fast as X?" are:

  1. Did you build/run a release build? (using the --release flag)
  2. Indexing in Rust causes bounds checks. If you can express an iteration over an array/vector using an actual iterator you may be able to avoid those bound checks.

Yea!!!
Thanks mate! Now, the rust implementation is 4 times faster!