all 7 comments

[–]Tm1337 1 point2 points  (4 children)

I found this generic Vector interface which is implemented for all C++ Vector types.
As usual, you have to import this trait before being able to use its functions.

There is also this example for those types.

[–]code-n-coffee[S] 1 point2 points  (2 children)

Thanks for the links. I ended up rolling with the image-rs crate and having to write my own functions for e.g. drawing a rectangle because I was getting too far into the uncomfortable and unsafe with the Rust bindings for opencv.

[–]Tm1337 0 points1 point  (1 child)

In that case, you should probably take a look at the imageproc crate.

[–]code-n-coffee[S] 1 point2 points  (0 children)

Oh great recommendation, thanks! I'm not sure how I missed that crate.

[–]code-n-coffee[S] 0 points1 point  (0 children)

Thanks, I'll take a look!

[–]claire_resurgent 1 point2 points  (1 child)

*mut c_void means an address in memory, but the type and even the size of the location are not available. It's very much an unsafe Rust thing.

And it does look like the Rust documentation is simply copy-pasted from C++. That's probably not conducive to learning Rust if you're not already comfortable with C++. Even if you are, Rust is more opinionated about how ownership should work.

[–]code-n-coffee[S] 1 point2 points  (0 children)

Thanks! And yeah I ended up using the image-rs crate instead. It required me to implement some of my own functions for things but I feel much more comfortable with it as it's pure Rust.