diff options
| author | 2024-06-05 04:06:00 +0800 | |
|---|---|---|
| committer | 2024-06-05 04:06:00 +0800 | |
| commit | 09413f06949b421a1c5b0cc05d70d84b184d3397 (patch) | |
| tree | 7b74bdafac7fb420d73137683209ba7d46acdda2 /src/lib.rs | |
| parent | 28a7b2ecd90e7e67427682a99b8616e13042b4ab (diff) | |
| download | HydroRollCore-09413f06949b421a1c5b0cc05d70d84b184d3397.tar.gz HydroRollCore-09413f06949b421a1c5b0cc05d70d84b184d3397.zip | |
feat(rust): wrap_pyfunction "process_rule_pack" in libcore module
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,15 +1,16 @@ use pyo3::prelude::*; +use pyo3::wrap_pyfunction; -/// Formats the sum of two numbers as string. #[pyfunction] -fn sum_as_string(a: usize, b: usize) -> PyResult<String> { - Ok((a + b).to_string()) +fn process_rule_pack(rule_pack: &str) -> PyResult<String> { + // 处理规则包的逻辑 + Ok(format!("Processed rule pack: {}", rule_pack)) } /// A Python module implemented in Rust. #[pymodule] #[pyo3(name = "libcore")] -fn corelib(_py: Python, m: &PyModule) -> PyResult<()> { - m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; +fn libcore(_py: Python, m: &PyModule) -> PyResult<()> { + m.add_function(wrap_pyfunction!(process_rule_pack, m)?)?; Ok(()) }
\ No newline at end of file |
