Rust python bindings with PyO3: TypeError: argument 'qr': 'QR2d' object cannot be converted to 'QR2d' #3244
-
I have
Next, I want to use QR2d in my other file
However when I try to do
I get the error
Does anyone know why this is? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Type objects are currently private to each extension due to the linkage model of Rust, i.e. static linking without a stable ABI. Hence the The easiest way around that is have only one Rust extension and limit reuse to within the Rust code. Other ways like capsule API as used by other native extensions written in e.g. C/C++ are possible but more involved and currently nothing specifically helpful for Rust/PyO3 exists. |
Beta Was this translation helpful? Give feedback.
Type objects are currently private to each extension due to the linkage model of Rust, i.e. static linking without a stable ABI. Hence the
QR2d
type fromlb_py
is a different type than theQR2d
type fromtypes_py
.The easiest way around that is have only one Rust extension and limit reuse to within the Rust code.
Other ways like capsule API as used by other native extensions written in e.g. C/C++ are possible but more involved and currently nothing specifically helpful for Rust/PyO3 exists.