integration between Python and Rust - Part 1
Let’s get our feet wet; in this first part I’ll write about a very simple way to interface Rust and Python. First of all let’s build a Rust dynamic library with some basic functions. // this file is: src/lib.rs #[no_mangle] pub extern "C" fn hello() { println!("Hello from the library!"); } #[no_mangle] pub extern "C" fn sum(a: i32, b: i32) -> i32 { a + b } your Cargo.toml should look like this: [package] name = "pyrust" version = "0.1.0" edition = "2018" [dependencies] [lib] crate-type = ["cdylib"] compile the library with cargo build ...