diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -1,19 +1,24 @@ use pyo3::prelude::*; -use pyo3::wrap_pyfunction; #[pyfunction] -fn process_rule_pack(rule_pack: &str) -> PyResult<String> { - Ok(format!("Processed rule pack: {}", rule_pack)) +fn sum_as_string(a: usize, b: usize) -> PyResult<String> { + Ok((a + b).to_string()) } -#[pymodule] -#[pyo3(name = "LibCore")] -fn libcore(_py: Python, m: &PyModule) -> PyResult<()> { - let _py_hrc_log = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/hrc/log.py")); - let _py_hrc_event = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/hrc/event.py")); - let _py_hrc_core = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/hrc/core.py")); - let _py_hrc_const = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/hrc/const.py")); +#[pyclass] +pub struct Base { + pub value: i32, +} - m.add_function(wrap_pyfunction!(process_rule_pack, m)?)?; - Ok(()) +impl Base { + fn new(value: i32) -> Self { + Base { value } + } } + +#[pymodule] +fn _core(_py: Python<'_>, m: &PyModule) -> PyResult<()> { + m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; + m.add_class::<Base>()?; + Ok(()) +}
\ No newline at end of file |
