feat: add lookup_index_by_key to Rust Vector for index-based search#8959
Conversation
|
@jtdavis777 I'd appreciate you also review this PR. |
…ust/add-lookup-index-by-key
|
Thanks for your feedback @jtdavis777 . I removed duplicated codes. Please review again |
|
@jtdavis777 Any update for me, please |
|
@jtdavis777 Please let me know any feedbacks. what else should I update? |
|
@statxc looks like there is a merge conflict in the tests. can you merge or rebase on master for me? |
|
@jtdavis777 Fixed conflicts. Could you run CI testing? |
|
@jtdavis777 I saw testing error. I found problem - I missed closing bracket |
|
Should I send another pr for this? please let me know your best option |
|
interesting this wasn't caught by the tests themselves.. did they not run properly? can you inspect the testing logs? Just submit a new PR, no need for a new issue just reference your comment. |
|
@jtdavis777 please check this. it is testing error log. I will submit new pr for this. |
|
ahh sure enough. Do we not have those tests marked as required?? Lovely. Thank you for being thorough, looking forward to the fix PR. I only have a little bit of time each day to review but we can get this in as soon as possible. |
|
@jtdavis777 Fixed error. Please review this PR: #8969 |
Closes: #8667
Problem
lookup_by_keyperforms binary search on sorted vectors but can only return the matched object. There is no way to get the element's index, which is needed when using vector positions as references (e.g., graph adjacency lists, ECS entity lookups, index-based cross-referencing between vectors).Fix
Add
lookup_index_by_keytoVector- identical binary search logic aslookup_by_key, but returnsOption<usize>(the index) instead ofOption<T::Inner>(the object).Changes
rust/flatbuffers/src/vector.rs- addlookup_index_by_keymethod onVector<'a, T>tests/rust_usage_test/tests/integration_test.rs- add 5 test cases for the new methodTest plan