autocxx
autocxx copied to clipboard
Make creating `std::vector` on the Rust side possible
Supose we have a struct A, and a function void processA(const vector<A> &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 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:
std::vector<A> convertToCppVector (rust::Vec<A>) {...}
However autocxx does not currently support rust::Vec.
For non-trivial A this is not possible as Vec<T>does not support T being an opaque C++ type.
Manual example, requiring C++ addition. https://github.com/google/autocxx/compare/create-vec in case I decide that we can't make this easier...