Created
February 10, 2024 00:58
-
-
Save dedSyn4ps3/f45a600fa50e099264b7a4a97f542c41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Says hello. | |
#[pyfunction] | |
fn say_hello(name: &str) { | |
println!("Hello there {name}!"); | |
} | |
/// Runs several test loops | |
#[pyfunction] | |
fn run_loops() { | |
logger::info("Running test loops..."); | |
let mut _count: u32 = 0; | |
for _ in 0..1000 { | |
for _ in 0..100 { | |
_count += 1; | |
} | |
} | |
print!("\n"); | |
logger::debug("Process Finished"); | |
} | |
#[pymodule] | |
fn rusty_python(_py: Python, m: &PyModule) -> PyResult<()> { | |
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; | |
m.add_function(wrap_pyfunction!(say_hello, m)?)?; | |
m.add_function(wrap_pyfunction!(run_loops, m)?)?; | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment