[go: up one dir, main page]

pyo3 0.12.3

Bindings to Python interpreter
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use pyo3::prelude::*;

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

fn main() {
    let t = TestClass { num: 10 };

    let gil = Python::acquire_gil();
    let py = gil.python();

    let pyvalue = Py::new(py, t).unwrap().to_object(py);
    let t: TestClass = pyvalue.extract(py).unwrap();
}