choyen_5000/
lib.rs

1use std::path::PathBuf;
2
3use pyo3::prelude::*;
4mod choyen_5000;
5
6pub fn generate_5000choyen(
7    top: &str,
8    bottom: &str,
9    file: &PathBuf,
10) -> Result<(), Box<dyn std::error::Error + Sync + Send>> {
11    Python::with_gil(|py| {
12        let generator = PyModule::from_code(py, choyen_5000::CODE, "", "").unwrap();
13
14        generator
15            .call_method(
16                "genImage_to",
17                (if !top.is_empty() { top } else { "5000兆円" }, 
18                if !bottom.is_empty() { bottom } else { "欲しい!" }, file),
19                None,
20            )
21            .unwrap();
22    });
23
24    Ok(())
25}