File size: 287 Bytes
54229f6
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
use pyo3::prelude::*;

#[pyfunction]
fn hello(name: &str) -> PyResult<String> {
    Ok(format!("Hello, {}! Welcome from Rust 🦀", name))
}

#[pymodule]
fn sample_rust(_py: Python, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(hello, m)?)?;
    Ok(())
}