Probably I miss something obvious here, because according to the internet the following should compile:
#[pyclass]
struct P2d {
x: f64,
y: f64
}
#[pyfunction]
pub fn try_vec_args(points: Vec<&P2d>) {
}
But it's not, the error is:
error[E0277]: the trait bound `Vec<&P2d>: FromPyObject<'_>` is not satisfied
--> src/lib.rs:24:29
|
24 | pub fn try_vec_args(points: Vec<&P2d>) {
| ^^^ the trait `FromPyObject<'_>` is not implemented for `Vec<&P2d>`
|
= help: the trait `FromPyObject<'a>` is implemented for `Vec<T>`
= note: required because of the requirements on the impl of `PyFunctionArgument<'_, '_>` for `Vec<&P2d>`
Inspired by this SO post:
I've tried all combinations of "&
", i.e. Vec<P2d>
, Vec<&P2d>
, &Vec<P2d>
and &Vec<&P2d>
and it never compiles for me. As far as I understand, ideally I'd like to pass &Vec<P2d>
argument because I don't want to transfer the ownership. Am I right here?