PyO2: A lightweight method to call Rust code from Python
Usage
File: Cargo.toml
[]
= "mylib"
= "0.1.0"
= "2021"
[]
= ["cdylib"]
[]
= "0.1.0"
File: src/lib.rs
use ;
pub extern "C" ```
File: *test.py*
```python
from pyo2 import RustDLL
dll = RustDLL
s = 'World'
lst =
dll.test
print
Output:
Hello, World!
Sum of numbers: 15
[6, 2, 3, 4, 5]