Hi, I have a uint8_t* in C++ and I want to pass it into my rust code and use it as a Vec<u8>.
The current way I am doing it is converting the uint8_t* to a vector<uint8_t> in C++ and then passing it to rust as a vec: &CxxVector<u8>.
Then, I do let new_vec: Vec<u8> = vec.iter().cloned().collect(); to obtain a Vec<u8> in Rust.
This works fine but takes a long time since my vector is huge (~14GB) and I have to iterate through it and clone it.
I wonder if there is a way to pass the pointer directly into rust and cast it to a Vec<u8> in rust.
Hi, I have a
uint8_t*
in C++ and I want to pass it into my rust code and use it as aVec<u8>
. The current way I am doing it is converting theuint8_t*
to avector<uint8_t>
in C++ and then passing it to rust as avec: &CxxVector<u8>
. Then, I dolet new_vec: Vec<u8> = vec.iter().cloned().collect();
to obtain aVec<u8>
in Rust.This works fine but takes a long time since my vector is huge (~14GB) and I have to iterate through it and clone it. I wonder if there is a way to pass the pointer directly into rust and cast it to a
Vec<u8>
in rust.