Closed jbrummack closed 3 months ago
If we perform the size check in the C layer - we would avoid breaking changes and could merge as is. How does that sound?
Sounds like a better solution. Adding some more tests in the Rust part is probably a good idea; throwing out the changes in Rust except the test for having different vector sizes and relying on the C layer for making it pass.
Yes, @jbrummack! Please let me know if you'd have time to implement those changes 🤗
I certainly have time to implement more Rust tests, as its probably synergistic with using the library in projects. I am not really constrained by time, but looking at the c layer would take a while since I don't have much experience with c/c++ (yet).
This should fix the problem of segfaulting by checking whether the dimensions are adding up and handling the edge case of hamming distance. Due to
cxx::Exception
being private I had to create a new error type that wraps C++ Exceptions and can output errors from "rustland". Therefore this fix could introduce breaking changes It works in my (small) codebase and passes tests, but due to finding more cases that cause an unexpected segfault in rust, I suggest merging these fixes together later.