Make creating `std::vector` on the Rust side possible
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
Supose we have a `struct A`, and a function `void processA(const vector &v)`.
In Rust we we want to create an `A` object and call the `processA` function with it, but this is currently not possible as there is no way to create a [`cxx::CxxVector`](https://docs.rs/cxx/0.3.4/cxx/struct.CxxVector.html) from Rust.
If `A` is a trivial type, we should be able to write a function that will convert between `rust::Vec` and `std::Vector`:
```C++
std::vector convertToCppVector (rust::Vec) {...}
```
However `autocxx` does not currently support `rust::Vec`.
For non-trivial `A` this is not possible as [`Vec`does not support T being an opaque C++ type](https://cxx.rs/binding/vec.html#restrictions).
Contributor guide
Research direction
Start by reading the linked CxxVector documentation and the stated restrictions on Vec for opaque C++ types. Then inspect the existing autocxx handling of rust::Vec and std::vector, if available, to determine the supported cases. Done means Rust can create and pass a std::vector to processA for the applicable trivial or non-trivial type cases, with the limitations documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100