Skip to content

[Rust] Add support for binary search returning the index #8667

@paraseba

Description

@paraseba

Sometimes finding the position of an object in a vector is more important than finding the object itself. Vectors currently have lookup_by_key, but that can only return the object, not the index.

Can we introduce a new function that returns the index instead?

Why are indexes important? You could have a data structure that uses vector indices as "pointers" into the vector. In this situation, calculating after you search for an element you may need its index. There are many other examples.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions