unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
2.15k stars 130 forks source link

[rust] add Sync,Send impl for Index #286

Closed weedge closed 11 months ago

ashvardanian commented 11 months ago

Hey, @weedge! Thanks for yet another commit! Can you please explain what it does?

weedge commented 11 months ago

@ashvardanian , there are some scenes, to use a global concurrent hashmap(mutex/rwlock) to store k/v (index_name/Index), view c++ impl is already threads safe, so add Sync, Send for Index in rust threads safe. find the cxx issuecomment like this : https://github.com/dtolnay/cxx/issues/1175#issuecomment-1430078152. https://cxx.rs/extern-c++.html#opaque-c-types