Module pyo3::conversion::test_no_clone

source ·
Expand description
use pyo3::prelude::*;

#[pyclass]
struct TestClass {
    num: u32,
}

let t = TestClass { num: 10 };

Python::with_gil(|py| {
    let pyvalue = Py::new(py, t).unwrap().to_object(py);
    let t: TestClass = pyvalue.extract(py).unwrap();
})
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here