Passing rust defined struct to other crate, from Python #3618
-
I have a mono-repo on which I'm working on with various sub packages. One of those sub package is a rust/python mixed PyO3 project (thanks for the amazing work BTW). I can interact as expected with my Rust code from Python. It turns out that one of the struct defined in rust is pretty useful for other sub package. I tried creating a second sub project Assuming the following structure:
If I define in
I can use it in
and call it from
However with more complex structs, that for example require to have
If I don't derive
Note that the I think I'm doing something wrong, here are my questions:
I'm sorry if I missed something obvious. I haven't found anything anywhere. Thanks in advance PS: I would have defined |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
impl<T> FromPyObject for T: PyClass + Clone
, which clones the data out of the Python object. You're conflicting with that implementation. This blanket has proved to be a mixed bag; in some ways it is very convenient but it has weakened error messages and also created situations like this.