diff options
| author | 2025-03-15 16:29:12 +0800 | |
|---|---|---|
| committer | 2025-03-15 16:29:12 +0800 | |
| commit | 06caca8b9a9a1df9932c2c82e4ddba80d49edc5c (patch) | |
| tree | 65d8b00475678e0205801247c32b3c5620b27142 | |
| parent | de9e8a0c7388bc04acb951a2a687c73adb38e7ff (diff) | |
| download | conventional_role_play-06caca8b9a9a1df9932c2c82e4ddba80d49edc5c.tar.gz conventional_role_play-06caca8b9a9a1df9932c2c82e4ddba80d49edc5c.zip | |
bump: update pyo3 dependency to version 0.24.0 and improve module function signature
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/lib.rs | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -15,5 +15,5 @@ name = "_core" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.19.2", features = ["abi3-py39"] } +pyo3 = { version = "0.24.0", features = ["abi3-py39"] } time = { version = "0.3.39", features = ["formatting", "macros", "local-offset"] } @@ -8,8 +8,11 @@ fn sum_as_string(a: usize, b: usize) -> PyResult<String> { #[pyclass] pub struct Base {} +/// A Python module implemented in Rust. The name of this function must match +/// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to +/// import the module. #[pymodule] -fn _core(_py: Python<'_>, m: &PyModule) -> PyResult<()> { +fn _core(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; m.add_class::<Base>()?; Ok(()) |
