我正在尝试使用PyO 3绑定在Rust中创建自己的Python库。虽然它给了我这个奇怪的错误,但我似乎无法修复。我试图将其转移到引用到PyList,但它只需要我指定一个生存期;然后反过来需要我使用PyO 3不允许的泛型。
下面是错误和我的代码:
error[E0277]: the trait bound `PyList: Clone` is not satisfied
--> src\lib.rs:8:5
|
5 | #[derive(Clone)]
| ----- in this derive macro expansion
...
8 | arguments: PyList,
| ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `PyList`
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
个字符
1条答案
按热度按时间pw9qyyiw1#
您可能不想直接存储
PyList
,而是Py<PyList>
。这将允许您避免#[pyclass(unsendable)]
,同时也是Clone
。字符串